Skyler Grey | 0409e46 | 2022-08-19 23:40:48 +0100 | [diff] [blame] | 1 | { |
| 2 | description = "Minion's NixOS configuration (since 2022-08-19)"; |
Skyler Grey | bcb2cb7 | 2022-08-21 07:24:35 +0100 | [diff] [blame] | 3 | inputs = { |
| 4 | nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; |
Skyler Grey | 2f9904e | 2022-09-05 03:18:02 +0100 | [diff] [blame] | 5 | nixpkgs-minion.url = "github:Minion3665/nixpkgs"; |
Skyler Grey | d01ca9c | 2022-11-02 08:08:32 +0000 | [diff] [blame] | 6 | nixpkgs-staging-next.url = "github:NixOS/nixpkgs/staging-next"; |
Skyler Grey | bcb2cb7 | 2022-08-21 07:24:35 +0100 | [diff] [blame] | 7 | flake-utils.url = "github:numtide/flake-utils"; |
Skyler Grey | 6be2517 | 2022-10-30 22:58:55 +0000 | [diff] [blame] | 8 | flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus"; |
Skyler Grey | 2a7ca38 | 2022-09-01 23:15:31 +0100 | [diff] [blame] | 9 | vscode-extensions.url = "github:AmeerTaweel/nix-vscode-marketplace"; |
Skyler Grey | bcb2cb7 | 2022-08-21 07:24:35 +0100 | [diff] [blame] | 10 | registry = { |
| 11 | url = "github:nixos/flake-registry"; |
| 12 | flake = false; |
| 13 | }; |
Skyler Grey | f8f0653 | 2022-11-04 10:58:38 +0000 | [diff] [blame] | 14 | home-manager.url = "github:nix-community/home-manager"; |
Skyler Grey | bcb2cb7 | 2022-08-21 07:24:35 +0100 | [diff] [blame] | 15 | sops-nix.url = "github:Mic92/sops-nix"; |
| 16 | impermanence.url = "github:nix-community/impermanence"; |
Skyler Grey | 2a7ca38 | 2022-09-01 23:15:31 +0100 | [diff] [blame] | 17 | gtimelog = { |
| 18 | url = "git+https://gitlab.collabora.com/collabora/gtimelog.git"; |
| 19 | flake = false; |
| 20 | }; |
Skyler Grey | 934f142 | 2022-09-04 11:50:04 +0100 | [diff] [blame] | 21 | fzf-tab = { |
| 22 | url = "github:Aloxaf/fzf-tab"; |
| 23 | flake = false; |
| 24 | }; |
Skyler Grey | a589ea1 | 2022-10-31 00:03:57 +0000 | [diff] [blame] | 25 | omnisharp-language-server = { |
| 26 | url = "github:coc-extensions/coc-omnisharp"; |
| 27 | flake = false; |
| 28 | }; |
| 29 | kmonad = { |
| 30 | url = "github:kmonad/kmonad?dir=nix"; |
| 31 | inputs.nixpkgs.follows = "nixpkgs"; |
| 32 | }; |
Skyler Grey | 6163585 | 2022-10-31 00:27:04 +0000 | [diff] [blame] | 33 | fenix.url = "github:nix-community/fenix"; |
Skyler Grey | d01ca9c | 2022-11-02 08:08:32 +0000 | [diff] [blame] | 34 | prismlauncher.url = "github:Scrumplex/nixpkgs/update-prismlauncher-5.1"; |
Skyler Grey | bcb2cb7 | 2022-08-21 07:24:35 +0100 | [diff] [blame] | 35 | |
Skyler Grey | 6163585 | 2022-10-31 00:27:04 +0000 | [diff] [blame] | 36 | fenix.inputs.nixpkgs.follows = "nixpkgs"; |
Skyler Grey | 6be2517 | 2022-10-30 22:58:55 +0000 | [diff] [blame] | 37 | flake-utils-plus.inputs.flake-utils.follows = "flake-utils"; |
Skyler Grey | bcb2cb7 | 2022-08-21 07:24:35 +0100 | [diff] [blame] | 38 | home-manager.inputs.nixpkgs.follows = "nixpkgs"; |
| 39 | sops-nix.inputs.nixpkgs.follows = "nixpkgs"; |
Skyler Grey | 7dfe5c6 | 2022-08-20 21:41:30 +0100 | [diff] [blame] | 40 | }; |
Skyler Grey | 0409e46 | 2022-08-19 23:40:48 +0100 | [diff] [blame] | 41 | |
Skyler Grey | 252927a | 2022-10-18 22:18:15 +0100 | [diff] [blame] | 42 | outputs = inputs: |
| 43 | let |
| 44 | inherit (inputs) self nixpkgs flake-utils; |
| 45 | in |
| 46 | flake-utils.lib.eachDefaultSystem (system: |
| 47 | let |
| 48 | pkgs = import nixpkgs { |
Skyler Grey | 7dfe5c6 | 2022-08-20 21:41:30 +0100 | [diff] [blame] | 49 | inherit system; |
Skyler Grey | 6163585 | 2022-10-31 00:27:04 +0000 | [diff] [blame] | 50 | overlays = import ./overlays nixpkgs.lib (inputs // { inherit inputs |
| 51 | username; }); |
Skyler Grey | 7dfe5c6 | 2022-08-20 21:41:30 +0100 | [diff] [blame] | 52 | }; |
Skyler Grey | 252927a | 2022-10-18 22:18:15 +0100 | [diff] [blame] | 53 | |
| 54 | utils = import ./utils nixpkgs.lib; |
| 55 | |
| 56 | username = "minion"; |
| 57 | |
| 58 | isAttrType = type: |
| 59 | if builtins.elem type.name [ "submodule" ] |
| 60 | then true |
| 61 | else if type ? nestedTypes.elemType |
| 62 | then isAttrType type.nestedTypes.elemType |
| 63 | else false; |
| 64 | |
| 65 | normalizeOptions = options: |
| 66 | if |
| 67 | nixpkgs.lib.traceSeqN 2 |
| 68 | { |
| 69 | inherit options; |
| 70 | type = builtins.typeOf options; |
| 71 | } |
| 72 | builtins.typeOf |
| 73 | options |
| 74 | == "set" |
| 75 | then |
| 76 | nixpkgs.lib.mapAttrs |
| 77 | ( |
| 78 | name: value: |
| 79 | if |
| 80 | nixpkgs.lib.traceSeqN 3 |
| 81 | { |
| 82 | inherit name value; |
| 83 | hasGetSubOpts = value ? getSubOptions; |
| 84 | hasType = value ? type; |
| 85 | isAttrType = value ? type && isAttrType value.type; |
| 86 | typeName = value.type.name or "unnamed"; |
| 87 | type = builtins.typeOf value; |
| 88 | } |
| 89 | (builtins.typeOf value) |
| 90 | == "set" |
| 91 | then |
| 92 | nixpkgs.lib.traceVal |
| 93 | (normalizeOptions ( |
| 94 | if value ? type && isAttrType value.type |
| 95 | then nixpkgs.lib.traceVal (value.type.getSubOptions [ ]) |
| 96 | else nixpkgs.lib.traceVal value |
| 97 | )) |
| 98 | else value |
| 99 | ) |
| 100 | options |
| 101 | else options; |
| 102 | in |
| 103 | { |
| 104 | packages.nixosConfigurations = { |
| 105 | default = nixpkgs.lib.nixosSystem { |
| 106 | inherit system; |
| 107 | |
| 108 | modules = [ |
| 109 | (nixpkgs.lib.pipe ./modules [ |
| 110 | utils.nixFilesIn |
| 111 | (utils.interpretNonstandardModule (args: |
| 112 | args |
| 113 | // { |
| 114 | home = args.config.home-manager.users.${username}; |
| 115 | home-options = |
| 116 | nixpkgs.lib.traceVal (normalizeOptions |
| 117 | (args.options.home-manager.users.type.getSubOptions [ ])); |
| 118 | inherit system utils; |
| 119 | })) |
| 120 | ]) |
| 121 | { |
| 122 | minion = import ./config.nix; |
| 123 | } |
| 124 | ]; |
| 125 | |
| 126 | specialArgs = inputs // { inherit inputs username; }; |
| 127 | }; |
| 128 | }; |
| 129 | devShell = pkgs.mkShell { |
| 130 | nativeBuildInputs = with pkgs; [ nodePackages.prettier nixpkgs-fmt ]; |
| 131 | buildInputs = [ ]; |
| 132 | }; |
| 133 | formatter = pkgs.nixpkgs-fmt; |
| 134 | }); |
Skyler Grey | 0409e46 | 2022-08-19 23:40:48 +0100 | [diff] [blame] | 135 | } |