-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
66 lines (62 loc) · 1.87 KB
/
flake.nix
File metadata and controls
66 lines (62 loc) · 1.87 KB
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
{
inputs = {
secrets.url = "path:/home/ewan/shit/secrets";
flake-utils.url = "github:numtide/flake-utils";
home-manager.url = "github:nix-community/home-manager";
hyprland.url = "github:hyprwm/Hyprland";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
firefox = {
url = "github:nix-community/flake-firefox-nightly";
inputs.nixpkgs.follows = "nixpkgs";
};
stylix = {
url = "github:nix-community/stylix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{ self, flake-utils, nixpkgs, ... }@inputs:
import ./systems.nix inputs
// flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = (import nixpkgs { inherit system; });
upfrontAuth = true;
in
{
devShell = with pkgs; mkShell {
nativeBuildInputs = [
(lib.optionals (!upfrontAuth) (pkgs.writeShellScriptBin "sudo" ''
printf "\33[2K%s\n" "awaiting authentication..."
/run/wrappers/bin/sudo "$@"
printf "\33[2K\r"
''))
(writeShellScriptBin "rebuild" ''
nixos-rebuild switch --flake .#$(hostname) \
--max-jobs 24 \
--cores 8 \
--no-reexec \
--show-trace \
$@
'')
(writeShellScriptBin "update" ''
nix flake update secrets
${if upfrontAuth then ''
printf "\33[2K%s\n" "awaiting upfront authentication..."
user="$(whoami)"
HOME= sudo -E rebuild
printf "\33[2K\r"
'' else ''
rebuild --sudo
''}
'')
];
buildInputs = [ fish ];
};
}
);
}