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 | bcb2cb7 | 2022-08-21 07:24:35 +0100 | [diff] [blame] | 6 | flake-utils.url = "github:numtide/flake-utils"; |
Skyler Grey | 6be2517 | 2022-10-30 22:58:55 +0000 | [diff] [blame] | 7 | flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus"; |
Skyler Grey | 2a7ca38 | 2022-09-01 23:15:31 +0100 | [diff] [blame] | 8 | vscode-extensions.url = "github:AmeerTaweel/nix-vscode-marketplace"; |
Skyler Grey | bcb2cb7 | 2022-08-21 07:24:35 +0100 | [diff] [blame] | 9 | registry = { |
| 10 | url = "github:nixos/flake-registry"; |
| 11 | flake = false; |
| 12 | }; |
| 13 | home-manager.url = "github:nix-community/home-manager/release-22.05"; |
Skyler Grey | 2a7ca38 | 2022-09-01 23:15:31 +0100 | [diff] [blame] | 14 | home-manager-unstable.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 | bcb2cb7 | 2022-08-21 07:24:35 +0100 | [diff] [blame] | 33 | |
Skyler Grey | 6be2517 | 2022-10-30 22:58:55 +0000 | [diff] [blame] | 34 | flake-utils-plus.inputs.flake-utils.follows = "flake-utils"; |
Skyler Grey | bcb2cb7 | 2022-08-21 07:24:35 +0100 | [diff] [blame] | 35 | home-manager.inputs.nixpkgs.follows = "nixpkgs"; |
Skyler Grey | 2a7ca38 | 2022-09-01 23:15:31 +0100 | [diff] [blame] | 36 | home-manager-unstable.inputs.nixpkgs.follows = "nixpkgs"; |
Skyler Grey | bcb2cb7 | 2022-08-21 07:24:35 +0100 | [diff] [blame] | 37 | sops-nix.inputs.nixpkgs.follows = "nixpkgs"; |
Skyler Grey | 7dfe5c6 | 2022-08-20 21:41:30 +0100 | [diff] [blame] | 38 | }; |
Skyler Grey | 0409e46 | 2022-08-19 23:40:48 +0100 | [diff] [blame] | 39 | |
Skyler Grey | 252927a | 2022-10-18 22:18:15 +0100 | [diff] [blame] | 40 | outputs = inputs: |
| 41 | let |
| 42 | inherit (inputs) self nixpkgs flake-utils; |
| 43 | in |
| 44 | flake-utils.lib.eachDefaultSystem (system: |
| 45 | let |
| 46 | pkgs = import nixpkgs { |
Skyler Grey | 7dfe5c6 | 2022-08-20 21:41:30 +0100 | [diff] [blame] | 47 | inherit system; |
Skyler Grey | 252927a | 2022-10-18 22:18:15 +0100 | [diff] [blame] | 48 | overlays = import ./overlays nixpkgs.lib; |
Skyler Grey | 7dfe5c6 | 2022-08-20 21:41:30 +0100 | [diff] [blame] | 49 | }; |
Skyler Grey | 252927a | 2022-10-18 22:18:15 +0100 | [diff] [blame] | 50 | |
| 51 | utils = import ./utils nixpkgs.lib; |
| 52 | |
| 53 | username = "minion"; |
| 54 | |
| 55 | isAttrType = type: |
| 56 | if builtins.elem type.name [ "submodule" ] |
| 57 | then true |
| 58 | else if type ? nestedTypes.elemType |
| 59 | then isAttrType type.nestedTypes.elemType |
| 60 | else false; |
| 61 | |
| 62 | normalizeOptions = options: |
| 63 | if |
| 64 | nixpkgs.lib.traceSeqN 2 |
| 65 | { |
| 66 | inherit options; |
| 67 | type = builtins.typeOf options; |
| 68 | } |
| 69 | builtins.typeOf |
| 70 | options |
| 71 | == "set" |
| 72 | then |
| 73 | nixpkgs.lib.mapAttrs |
| 74 | ( |
| 75 | name: value: |
| 76 | if |
| 77 | nixpkgs.lib.traceSeqN 3 |
| 78 | { |
| 79 | inherit name value; |
| 80 | hasGetSubOpts = value ? getSubOptions; |
| 81 | hasType = value ? type; |
| 82 | isAttrType = value ? type && isAttrType value.type; |
| 83 | typeName = value.type.name or "unnamed"; |
| 84 | type = builtins.typeOf value; |
| 85 | } |
| 86 | (builtins.typeOf value) |
| 87 | == "set" |
| 88 | then |
| 89 | nixpkgs.lib.traceVal |
| 90 | (normalizeOptions ( |
| 91 | if value ? type && isAttrType value.type |
| 92 | then nixpkgs.lib.traceVal (value.type.getSubOptions [ ]) |
| 93 | else nixpkgs.lib.traceVal value |
| 94 | )) |
| 95 | else value |
| 96 | ) |
| 97 | options |
| 98 | else options; |
| 99 | in |
| 100 | { |
| 101 | packages.nixosConfigurations = { |
| 102 | default = nixpkgs.lib.nixosSystem { |
| 103 | inherit system; |
| 104 | |
| 105 | modules = [ |
| 106 | (nixpkgs.lib.pipe ./modules [ |
| 107 | utils.nixFilesIn |
| 108 | (utils.interpretNonstandardModule (args: |
| 109 | args |
| 110 | // { |
| 111 | home = args.config.home-manager.users.${username}; |
| 112 | home-options = |
| 113 | nixpkgs.lib.traceVal (normalizeOptions |
| 114 | (args.options.home-manager.users.type.getSubOptions [ ])); |
| 115 | inherit system utils; |
| 116 | })) |
| 117 | ]) |
| 118 | { |
| 119 | minion = import ./config.nix; |
| 120 | } |
| 121 | ]; |
| 122 | |
| 123 | specialArgs = inputs // { inherit inputs username; }; |
| 124 | }; |
| 125 | }; |
| 126 | devShell = pkgs.mkShell { |
| 127 | nativeBuildInputs = with pkgs; [ nodePackages.prettier nixpkgs-fmt ]; |
| 128 | buildInputs = [ ]; |
| 129 | }; |
| 130 | formatter = pkgs.nixpkgs-fmt; |
| 131 | }); |
Skyler Grey | 0409e46 | 2022-08-19 23:40:48 +0100 | [diff] [blame] | 132 | } |