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