feat: Added nixos-anywhere installer
This commit is contained in:
@@ -62,7 +62,6 @@ in {
|
|||||||
nodejs
|
nodejs
|
||||||
deploy-rs
|
deploy-rs
|
||||||
vcpkg-tool
|
vcpkg-tool
|
||||||
gh
|
|
||||||
just
|
just
|
||||||
yarn
|
yarn
|
||||||
clang
|
clang
|
||||||
@@ -139,12 +138,14 @@ in {
|
|||||||
extraConfig =
|
extraConfig =
|
||||||
lib.strings.optionalString pkgs.stdenv.isDarwin
|
lib.strings.optionalString pkgs.stdenv.isDarwin
|
||||||
''
|
''
|
||||||
IdentityAgent ~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock
|
IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
|
||||||
''
|
''
|
||||||
+ lib.strings.optionalString pkgs.stdenv.isLinux ''
|
+ lib.strings.optionalString pkgs.stdenv.isLinux ''
|
||||||
IdentityAgent ~/.1password/agent.sock
|
IdentityAgent ~/.1password/agent.sock
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
gh.enable = true;
|
||||||
|
gh-dash.enable = true;
|
||||||
sketchybar.enable = device.isMac;
|
sketchybar.enable = device.isMac;
|
||||||
atuin = {
|
atuin = {
|
||||||
settings = {
|
settings = {
|
||||||
|
|||||||
6
flake.lock
generated
6
flake.lock
generated
@@ -1910,11 +1910,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1727999297,
|
"lastModified": 1730698801,
|
||||||
"narHash": "sha256-LTJuQPCsSItZ/8TieFeP30iY+uaLoD0mT0tAj1gLeyQ=",
|
"narHash": "sha256-sq68bCmk4tCXSt5CoRNimfigIZSLJSpNi/gjFtNLjRE=",
|
||||||
"owner": "LnL7",
|
"owner": "LnL7",
|
||||||
"repo": "nix-darwin",
|
"repo": "nix-darwin",
|
||||||
"rev": "8c8388ade72e58efdeae71b4cbb79e872c23a56b",
|
"rev": "189d2d422c773fa065cc9c72e6806f007ebb9be0",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
{...}: {
|
|
||||||
services.cachix-agent = {
|
|
||||||
enable = true;
|
|
||||||
name = "mirai";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
30
server/configuration.nix
Normal file
30
server/configuration.nix
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
modulesPath,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
imports = [
|
||||||
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
|
(modulesPath + "/profiles/qemu-guest.nix")
|
||||||
|
./disk-config.nix
|
||||||
|
];
|
||||||
|
boot.loader.grub = {
|
||||||
|
# no need to set devices, disko will add all devices that have a EF02 partition to the list already
|
||||||
|
# devices = [ ];
|
||||||
|
efiSupport = true;
|
||||||
|
efiInstallAsRemovable = true;
|
||||||
|
};
|
||||||
|
services.openssh.enable = true;
|
||||||
|
|
||||||
|
environment.systemPackages = map lib.lowPrio [
|
||||||
|
pkgs.curl
|
||||||
|
pkgs.gitMinimal
|
||||||
|
];
|
||||||
|
|
||||||
|
users.users.root.openssh.authorizedKeys.keys = [
|
||||||
|
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDMh7ohX3cIB/euZwy9hk8iKywlu+koHrOiyaEG/ubr7Lfr+d92HV8arAIow52VMzv17sUBiP8Us/13FTtlLNKle7VXi5Eh+BBzNjOU/bpDKe4XZQtiEnnVd7LzLaAYfS+Gg9cD9hG3GGaxPYe8iN5bfpR1l15ccUTPHvBtefAoPax5bnMd89Z82stWvnpFs42YtP5VXLwMjk2nZhst1AspXMFxvsg/vkniMun+SuzyoQGkEo+ncTEmQzEQF5JpWEsfBdhmcOJnWoIWNcaWTAmVbF4Xkv5GqtdibXykVjlTUtrsVrBvvTL+BfQ99qiCafyWIhQgULDqXY2Ocq6mK9ZBohDzzsR0W/TXvRVIShfaRK6qmArcr4dSGQpd2H7/dJtpM9xHXSSyGhNHrlRFCTLBjHxjYrax9JzeRIWFSpNGOl3rUmI0P3FZJLBP9P6DJ9wJiksWD3kDRjaMQmr3gZhqAq6qYZIkSHiW1tLqcCncEFCdb/x5XJzkqEv3wPbKD1t4D0iBvSaFRaJTiTr611MlkS69T/5JCJW5RQoxE9qTV7X6WiQUToll/NqQ6Ox5mlQbj/zv4gFQq0CEHm/EgemHzHXatkMbV8ze/JHZFs3kxqaL6881yfVYWQIT8UbFZNdvJUd+VLWF5PpnXBWEH0+yPXttTyNSirztr1deTbZhDw=="
|
||||||
|
];
|
||||||
|
|
||||||
|
system.stateVersion = "24.05";
|
||||||
|
}
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
{...}: {
|
|
||||||
imports = [
|
|
||||||
./cachix.nix
|
|
||||||
];
|
|
||||||
}
|
|
||||||
94
server/disk-config.nix
Normal file
94
server/disk-config.nix
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
{lib, ...}: {
|
||||||
|
disko.devices = {
|
||||||
|
disk = {
|
||||||
|
one = {
|
||||||
|
type = "disk";
|
||||||
|
device = "/dev/nvme0n1";
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
boot = {
|
||||||
|
size = "512M";
|
||||||
|
type = "EF00";
|
||||||
|
content = {
|
||||||
|
type = "mdraid";
|
||||||
|
name = "boot";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
primary = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "lvm_pv";
|
||||||
|
vg = "pool";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
two = {
|
||||||
|
type = "disk";
|
||||||
|
device = "/dev/nvme1n1";
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
boot = {
|
||||||
|
size = "512M";
|
||||||
|
type = "EF00";
|
||||||
|
content = {
|
||||||
|
type = "mdraid";
|
||||||
|
name = "boot";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
primary = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "lvm_pv";
|
||||||
|
vg = "pool";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
mdadm = {
|
||||||
|
boot = {
|
||||||
|
type = "mdadm";
|
||||||
|
level = 1;
|
||||||
|
metadata = "1.0";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
lvm_vg = {
|
||||||
|
pool = {
|
||||||
|
type = "lvm_vg";
|
||||||
|
lvs = {
|
||||||
|
root = {
|
||||||
|
size = "128G";
|
||||||
|
lvm_type = "mirror";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "ext4";
|
||||||
|
mountpoint = "/";
|
||||||
|
mountOptions = [
|
||||||
|
"defaults"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
home = {
|
||||||
|
size = "512G";
|
||||||
|
lvm_type = "raid0";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "ext4";
|
||||||
|
mountpoint = "/home";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
64
server/flake.lock
generated
Normal file
64
server/flake.lock
generated
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"disko": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1730675461,
|
||||||
|
"narHash": "sha256-Mhqz3p/HEiI/zxBJWO57LYQf6gGlJB0tci6fiVXLjd8=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "disko",
|
||||||
|
"rev": "380847d94ff0fedee8b50ee4baddb162c06678df",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "disko",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixos-facter-modules": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1730715598,
|
||||||
|
"narHash": "sha256-FPSbetOjBJp+pRadleiSVioAiHPerUDsYlTAWLCX+Tw=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "nixos-facter-modules",
|
||||||
|
"rev": "5db1750d7663f96f0babb454320047af0866acf8",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "nixos-facter-modules",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1730272153,
|
||||||
|
"narHash": "sha256-B5WRZYsRlJgwVHIV6DvidFN7VX7Fg9uuwkRW9Ha8z+w=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "2d2a9ddbe3f2c00747398f3dc9b05f7f2ebb0f53",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"disko": "disko",
|
||||||
|
"nixos-facter-modules": "nixos-facter-modules",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
41
server/flake.nix
Normal file
41
server/flake.nix
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
|
inputs.disko.url = "github:nix-community/disko";
|
||||||
|
inputs.disko.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
inputs.nixos-facter-modules.url = "github:numtide/nixos-facter-modules";
|
||||||
|
|
||||||
|
outputs = {
|
||||||
|
nixpkgs,
|
||||||
|
disko,
|
||||||
|
nixos-facter-modules,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
# Use this for all other targets
|
||||||
|
# nix run github:nix-community/nixos-anywhere -- --flake .#generic --generate-hardware-config nixos-generate-config ./hardware-configuration.nix root@sh.darksailor.dev
|
||||||
|
nixosConfigurations.generic = nixpkgs.lib.nixosSystem {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
modules = [
|
||||||
|
disko.nixosModules.disko
|
||||||
|
./configuration.nix
|
||||||
|
./hardware-configuration.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Slightly experimental: Like generic, but with nixos-facter (https://github.com/numtide/nixos-facter)
|
||||||
|
# nix run github:nix-community/nixos-anywhere -- --flake .#generic-nixos-facter --generate-hardware-config nixos-facter facter.json root@sh.darksailor.dev
|
||||||
|
nixosConfigurations.generic-nixos-facter = nixpkgs.lib.nixosSystem {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
modules = [
|
||||||
|
disko.nixosModules.disko
|
||||||
|
./configuration.nix
|
||||||
|
nixos-facter-modules.nixosModules.facter
|
||||||
|
{
|
||||||
|
config.facter.reportPath =
|
||||||
|
if builtins.pathExists ./facter.json
|
||||||
|
then ./facter.json
|
||||||
|
else throw "Have you forgotten to run nixos-anywhere with `--generate-hardware-config nixos-facter ./facter.json`?";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user