-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
118 lines (108 loc) · 3.17 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager?ref=release-24.05";
flake-utils.url = "github:numtide/flake-utils";
nix-index-database.url = "github:Mic92/nix-index-database";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
sops.url = "github:Mic92/sops-nix";
nu_scripts = {
type = "git";
url = "https://github.com/nushell/nu_scripts";
submodules = true;
flake = false;
};
nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
};
outputs = {
self,
flake-utils,
...
} @ inputs: let
system = import ./users/amy/config.nix;
inherit inputs;
overlays = final: prev:
{
unstable = import inputs.nixpkgs-unstable {
inherit (prev) system;
config.allowUnfree = true;
};
}
// (import ./users/${system.currentUser}/overlays final prev);
in
{
nixosConfigurations.nixon = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({
config,
pkgs,
lib,
...
}: (import ./machines/desktop {
inherit config inputs pkgs lib;
}))
({config, ...}: {
config = {
nixpkgs.overlays = [overlays];
nixpkgs.config.permittedInsecurePackages = [
# FIXME: For Obsidian Notes.
"electron-25.9.0"
];
};
})
inputs.home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "backup";
sharedModules = [
inputs.nix-index-database.hmModules.nix-index
inputs.sops.homeManagerModules.sops
];
extraSpecialArgs = {
flakePath = "/home/${system.currentUser}/nixos";
inherit (inputs) nu_scripts nix-vscode-extensions;
inherit system;
};
};
}
];
};
}
// flake-utils.lib.eachDefaultSystem (system: {
checks = {
pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
alejandra.enable = true;
editorconfig-checker.enable = true;
deadnix.enable = true;
shellcheck.enable = true;
stylua.enable = true;
};
settings.deadnix = {
noLambdaPatternNames = true;
noLambdaArg = true;
};
};
};
devShell = let
pkgs = inputs.nixpkgs.legacyPackages.${system};
unstable = inputs.nixpkgs-unstable.legacyPackages.${system};
in
pkgs.mkShell {
inherit (self.checks.${system}.pre-commit-check) shellHook;
packages = [
unstable.just
pkgs.sops
pkgs.nixpkgs-fmt
pkgs.nix-output-monitor
pkgs.nvd
pkgs.nixd
];
};
});
}