dotfiles/flake.nix

167 lines
4.7 KiB
Nix
Raw Normal View History

2021-05-30 20:41:33 +01:00
{
description = "NixOS configuration with flakes";
2022-02-20 16:23:55 +00:00
outputs = { self, flake-utils, home-manager, nixpkgs-nixos-unstable, nixpkgs-stable, nixos-hardware, nur, agenix, neuron, sops, discord } @ inputs:
2021-05-31 09:15:44 +01:00
2021-12-04 09:20:11 +00:00
let
mkServer = pkgs: system: hostname:
pkgs.lib.nixosSystem {
system = system;
modules = [
(./. + "/nixos/boxes/${hostname}")
agenix.nixosModules.age
sops.nixosModules.sops
];
specialArgs = { inherit inputs; };
};
2021-12-04 21:47:27 +00:00
mkRaspi = pkgs: hostname:
pkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
(./. + "/nixos/boxes/${hostname}")
];
specialArgs = { inherit inputs; };
};
2021-12-04 09:20:11 +00:00
mkWorkstation = pkgs: system: hostname:
pkgs.lib.nixosSystem {
system = system;
modules = [
(./. + "/nixos/boxes/${hostname}")
(import ./nixos/email-accounts.nix)
sops.nixosModules.sops
2021-05-31 09:15:44 +01:00
2021-12-04 09:20:11 +00:00
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.cyryl = {
imports = [ ./nixos/home-manager ];
_module.args.inputs = inputs;
};
}
2021-05-31 09:15:44 +01:00
2021-12-04 09:20:11 +00:00
];
2022-02-20 15:57:58 +00:00
specialArgs = {
inherit inputs system;
unstableAndUnfree = import nixpkgs-nixos-unstable { inherit system; config = { allowUnfree = true; }; };
2022-02-20 16:23:55 +00:00
discord = import discord { inherit system; config = { allowUnfree = true; }; };
2022-02-20 15:57:58 +00:00
};
2021-12-04 09:20:11 +00:00
};
in
2021-05-31 09:15:44 +01:00
2021-12-04 09:20:11 +00:00
{
nixosConfigurations = {
2021-12-04 10:43:02 +00:00
foureighty = mkWorkstation nixpkgs-stable "x86_64-linux" "foureighty";
skinnyv = mkWorkstation nixpkgs-stable "x86_64-linux" "skinnyv";
thinky = mkWorkstation nixpkgs-stable "x86_64-linux" "thinky";
bolty = mkServer nixpkgs-stable "x86_64-linux" "bolty";
vultr1 = mkServer nixpkgs-stable "x86_64-linux" "vultr1";
2021-12-04 21:47:27 +00:00
rpi4_8 = mkRaspi nixpkgs-stable "rpi4-8";
2021-12-04 10:43:02 +00:00
2021-12-04 09:20:11 +00:00
bootstrap = nixpkgs-stable.lib.nixosSystem {
system = "x86_64-linux";
modules = [
(./. + "/nixos/boxes/bootstrap")
];
specialArgs = { inherit inputs; };
};
2021-12-04 10:43:02 +00:00
# nix build .#nixosConfigurations.raspiimage.config.system.build.sdImage
2021-12-04 11:02:32 +00:00
# sudo dd if=result/sd-image/nixos-sd-image-21.11.20211201.a640d83-aarch64-linux.img of=/dev/sda bs=4M conv=fsync status=progress
2021-12-04 10:43:02 +00:00
raspiimage = nixpkgs-stable.lib.nixosSystem {
system = "aarch64-linux";
modules = [
2021-12-04 21:47:27 +00:00
(import "${inputs.nixpkgs-nixos-unstable}/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix")
2021-12-04 10:43:02 +00:00
{
services.openssh = {
enable = true;
permitRootLogin = inputs.nixpkgs-stable.lib.mkForce "prohibit-password";
passwordAuthentication = false;
};
users.extraUsers.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE5Ejx5CAPUfHVXi4GL4WmnZaG8eiiOmsW/a0o1bs1GF cyryl@foureighty"
];
sdImage.compressImage = false;
2021-12-04 21:47:27 +00:00
console.earlySetup = true;
2021-12-04 10:43:02 +00:00
}
];
specialArgs = { inherit inputs; };
};
2021-06-26 19:12:31 +01:00
};
2021-05-31 09:15:44 +01:00
};
2021-05-30 20:41:33 +01:00
inputs = {
2021-06-01 14:30:39 +01:00
nixpkgs-nixos-unstable = {
2021-05-30 20:41:33 +01:00
type = "github";
2021-05-30 23:13:31 +01:00
owner = "NixOS";
repo = "nixpkgs";
ref = "nixos-unstable";
2021-05-30 20:41:33 +01:00
};
2021-05-31 09:15:44 +01:00
nixpkgs-stable = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
2021-12-04 09:20:11 +00:00
ref = "nixos-21.11";
2021-05-31 09:15:44 +01:00
};
2021-06-12 09:40:09 +01:00
nixos-hardware = {
type = "github";
owner = "NixOS";
2021-06-12 09:40:09 +01:00
repo = "nixos-hardware";
ref = "master";
2021-06-12 09:40:09 +01:00
};
2021-05-30 20:41:33 +01:00
home-manager = {
type = "github";
owner = "nix-community";
repo = "home-manager";
2021-12-04 09:20:11 +00:00
ref = "release-21.11";
2021-05-30 20:41:33 +01:00
inputs = {
2021-12-04 09:20:11 +00:00
nixpkgs.follows = "nixpkgs-stable";
2021-05-30 20:41:33 +01:00
};
};
2021-05-30 23:13:31 +01:00
flake-utils = {
2021-05-30 20:41:33 +01:00
type = "github";
2021-05-30 23:13:31 +01:00
owner = "numtide";
repo = "flake-utils";
ref = "master";
2021-05-30 20:41:33 +01:00
};
nur = {
type = "github";
owner = "nix-community";
repo = "NUR";
ref = "master";
};
2021-05-31 09:15:44 +01:00
agenix = {
type = "github";
owner = "ryantm";
repo = "agenix";
2021-11-26 15:37:27 +00:00
ref = "main";
2021-05-30 20:41:33 +01:00
};
2021-06-19 10:35:39 +01:00
neuron = {
type = "github";
owner = "srid";
repo = "neuron";
ref = "master";
};
2021-10-30 11:10:19 +01:00
sops = {
type = "github";
owner = "Mic92";
repo = "sops-nix";
ref = "master";
};
2022-02-20 16:23:55 +00:00
discord = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
ref = "e0c8e584ae000051db50c70cf6882e12e91b5e9f";
};
2021-05-30 20:41:33 +01:00
};
2021-05-31 09:15:44 +01:00
2021-05-30 20:41:33 +01:00
}