forked from the-nix-way/nome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
137 lines (124 loc) · 4.89 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# This flake was initially generated by fh, the CLI for FlakeHub (version 0.1.6)
# This was forked
{
description = "Nome: dbwest's Nix home";
inputs = {
fenix = { url = "https://flakehub.com/f/nix-community/fenix/0.1.*.tar.gz"; inputs.nixpkgs.follows = "nixpkgs"; };
solana-nix = { url = "github:cideM/solana-nix"; inputs.nixpkgs.follows = "nixpkgs"; };
fh = { url = "https://flakehub.com/f/DeterminateSystems/fh/0.1.*.tar.gz"; inputs.nixpkgs.follows = "nixpkgs"; };
flake-checker = { url = "https://flakehub.com/f/DeterminateSystems/flake-checker/0.1.*.tar.gz"; inputs.nixpkgs.follows = "nixpkgs"; };
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.*.tar.gz";
home-manager = { url = "https://flakehub.com/f/nix-community/home-manager/0.2311.*.tar.gz"; inputs.nixpkgs.follows = "nixpkgs"; };
nix-darwin = { url = "github:LnL7/nix-darwin"; inputs.nixpkgs.follows = "nixpkgs"; };
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2311.*.tar.gz";
nuenv = { url = "https://flakehub.com/f/DeterminateSystems/nuenv/0.1.*.tar.gz"; inputs.nixpkgs.follows = "nixpkgs"; };
# uuidv7 = { url = "git+ssh://[email protected]/DeterminateSystems/uuidv7.git"; inputs.nixpkgs.follows = "nixpkgs"; };
};
outputs = inputs:
let
supportedSystems = [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" "aarch64-linux" ];
forEachSupportedSystem = f: inputs.nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ inputs.self.overlays.default ];
};
});
stateVersion = "23.11";
system = "aarch64-darwin";
username = "davidwest";
hostname = "lilmac";
caches = {
nixos-org = {
cache = "https://cache.nixos.org";
publicKey = "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=";
};
nix-community = {
cache = "https://nix-community.cachix.org";
publicKey = "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=";
};
};
in
{
schemas = inputs.flake-schemas.schemas;
devShells = forEachSupportedSystem ({ pkgs }: {
default =
let
reload = pkgs.writeScriptBin "reload" ''
CONFIG_NAME="''${USER}-$(nix eval --impure --raw --expr 'builtins.currentSystem')"
${pkgs.nixFlakes}/bin/nix build .#darwinConfigurations."''${CONFIG_NAME}".system \
--option sandbox false
./result/sw/bin/darwin-rebuild switch --flake .
'';
in
pkgs.mkShell {
name = "nome";
packages = with pkgs; [
nixpkgs-fmt
reload
];
};
});
overlays.default = final: prev: {
inherit username system;
homeDirectory =
if (prev.stdenv.isDarwin)
then "/Users/${username}"
else "/home/${username}";
rev = inputs.self.rev or inputs.self.dirtyRev or null;
flake-checker = inputs.flake-checker.packages.${system}.default;
fh = inputs.fh.packages.${system}.default;
solana-nix = inputs.solana-nix.packages.${system}.solana;
# uuidv7 = inputs.uuidv7.packages.${system}.default;
rustToolchain = with inputs.fenix.packages.${system};
combine (with stable; [
cargo
clippy
rustc
rustfmt
rust-src
]);
};
darwinConfigurations."${username}-${system}" = inputs.nix-darwin.lib.darwinSystem {
inherit system;
modules = [
inputs.self.darwinModules.base
inputs.self.darwinModules.caching
inputs.home-manager.darwinModules.home-manager
inputs.self.darwinModules.home-manager
];
};
darwinConfigurations."lilmac" = inputs.nix-darwin.lib.darwinSystem {
inherit system;
modules = [
inputs.self.darwinModules.base
inputs.self.darwinModules.caching
inputs.home-manager.darwinModules.home-manager
inputs.self.darwinModules.home-manager
];
};
darwinModules = {
base = { pkgs, ... }: import ./nix-darwin/base {
inherit pkgs;
overlays = [
inputs.nuenv.overlays.default
inputs.self.overlays.default
];
};
caching = { ... }: import ./nix-darwin/caching {
inherit caches username;
};
home-manager = { pkgs, ... }: import ./home-manager {
inherit pkgs stateVersion username;
};
};
nixosConfigurations = rec {
default = simple;
simple = inputs.nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [ ./nixos/configuration.nix ./nixos/hardware-configuration.nix ];
};
};
templates = import
./templates;
};
}