blob: e8e545aed35d9c2385ce30c50ca99e1632dbfad2 [file] [log] [blame]
Skyler Grey0409e462022-08-19 23:40:48 +01001{
2 description = "Minion's NixOS configuration (since 2022-08-19)";
Skyler Greybcb2cb72022-08-21 07:24:35 +01003 inputs = {
4 nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
Skyler Grey2f9904e2022-09-05 03:18:02 +01005 nixpkgs-minion.url = "github:Minion3665/nixpkgs";
Skyler Greyd01ca9c2022-11-02 08:08:32 +00006 nixpkgs-staging-next.url = "github:NixOS/nixpkgs/staging-next";
Skyler Greybcb2cb72022-08-21 07:24:35 +01007 flake-utils.url = "github:numtide/flake-utils";
Skyler Grey6be25172022-10-30 22:58:55 +00008 flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus";
Skyler Grey2a7ca382022-09-01 23:15:31 +01009 vscode-extensions.url = "github:AmeerTaweel/nix-vscode-marketplace";
Skyler Greybcb2cb72022-08-21 07:24:35 +010010 registry = {
11 url = "github:nixos/flake-registry";
12 flake = false;
13 };
Skyler Greyf8f06532022-11-04 10:58:38 +000014 home-manager.url = "github:nix-community/home-manager";
Skyler Greybcb2cb72022-08-21 07:24:35 +010015 sops-nix.url = "github:Mic92/sops-nix";
16 impermanence.url = "github:nix-community/impermanence";
Skyler Grey2a7ca382022-09-01 23:15:31 +010017 gtimelog = {
18 url = "git+https://gitlab.collabora.com/collabora/gtimelog.git";
19 flake = false;
20 };
Skyler Grey934f1422022-09-04 11:50:04 +010021 fzf-tab = {
22 url = "github:Aloxaf/fzf-tab";
23 flake = false;
24 };
Skyler Greya589ea12022-10-31 00:03:57 +000025 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 Grey61635852022-10-31 00:27:04 +000033 fenix.url = "github:nix-community/fenix";
Skyler Greyd01ca9c2022-11-02 08:08:32 +000034 prismlauncher.url = "github:Scrumplex/nixpkgs/update-prismlauncher-5.1";
Skyler Greybcb2cb72022-08-21 07:24:35 +010035
Skyler Grey61635852022-10-31 00:27:04 +000036 fenix.inputs.nixpkgs.follows = "nixpkgs";
Skyler Grey6be25172022-10-30 22:58:55 +000037 flake-utils-plus.inputs.flake-utils.follows = "flake-utils";
Skyler Greybcb2cb72022-08-21 07:24:35 +010038 home-manager.inputs.nixpkgs.follows = "nixpkgs";
39 sops-nix.inputs.nixpkgs.follows = "nixpkgs";
Skyler Grey7dfe5c62022-08-20 21:41:30 +010040 };
Skyler Grey0409e462022-08-19 23:40:48 +010041
Skyler Grey252927a2022-10-18 22:18:15 +010042 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 Grey7dfe5c62022-08-20 21:41:30 +010049 inherit system;
Skyler Grey61635852022-10-31 00:27:04 +000050 overlays = import ./overlays nixpkgs.lib (inputs // { inherit inputs
51 username; });
Skyler Grey7dfe5c62022-08-20 21:41:30 +010052 };
Skyler Grey252927a2022-10-18 22:18:15 +010053
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 Grey0409e462022-08-19 23:40:48 +0100135}