2021-05-30 20:41:33 +01:00
|
|
|
{
|
|
|
|
description = "NixOS configuration with flakes";
|
2022-11-08 16:28:34 +00:00
|
|
|
outputs = { self, flake-utils, flake-compat, home-manager
|
|
|
|
, nixpkgs-nixos-unstable, nixpkgs-master, nixpkgs-stable, darwin
|
2022-12-07 23:52:15 +00:00
|
|
|
, nixos-hardware, nur, sops, nil, helix }@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 {
|
2022-05-02 09:59:47 +01:00
|
|
|
inherit system;
|
2022-08-19 20:28:58 +01:00
|
|
|
modules = [
|
|
|
|
(./. + "/nixos/boxes/${hostname}")
|
|
|
|
(import ./nixos/server-common.nix)
|
|
|
|
sops.nixosModules.sops
|
|
|
|
];
|
2021-12-04 09:20:11 +00:00
|
|
|
specialArgs = { inherit inputs; };
|
|
|
|
};
|
2021-12-04 21:47:27 +00:00
|
|
|
mkRaspi = pkgs: hostname:
|
|
|
|
pkgs.lib.nixosSystem {
|
|
|
|
system = "aarch64-linux";
|
2022-03-08 00:17:06 +00:00
|
|
|
modules = [ (./. + "/nixos/boxes/${hostname}") ];
|
2021-12-04 21:47:27 +00:00
|
|
|
specialArgs = { inherit inputs; };
|
|
|
|
};
|
2022-09-26 11:26:36 +01:00
|
|
|
mkKiosk = pkgs: system: hostname:
|
2022-08-23 20:23:07 +01:00
|
|
|
pkgs.lib.nixosSystem {
|
|
|
|
inherit system;
|
|
|
|
modules = [
|
|
|
|
(./. + "/nixos/boxes/${hostname}")
|
|
|
|
|
|
|
|
sops.nixosModules.sops
|
|
|
|
|
|
|
|
home-manager.nixosModules.home-manager
|
|
|
|
{
|
|
|
|
home-manager.useGlobalPkgs = true;
|
|
|
|
home-manager.useUserPackages = true;
|
|
|
|
home-manager.users.cyryl = {
|
|
|
|
imports =
|
2022-09-26 11:26:36 +01:00
|
|
|
[ ./nixos/home-manager ./nixos/home-manager/linux.nix ];
|
2022-08-23 20:23:07 +01:00
|
|
|
_module.args.inputs = inputs;
|
2022-12-04 12:33:54 +00:00
|
|
|
_module.args.system = system;
|
2022-08-23 20:23:07 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
];
|
2022-10-23 10:51:00 +01:00
|
|
|
specialArgs = { inherit inputs system; };
|
2022-08-23 20:23:07 +01:00
|
|
|
};
|
2021-12-04 09:20:11 +00:00
|
|
|
mkWorkstation = pkgs: system: hostname:
|
|
|
|
pkgs.lib.nixosSystem {
|
2022-05-02 09:59:47 +01:00
|
|
|
inherit system;
|
2021-12-04 09:20:11 +00:00
|
|
|
modules = [
|
|
|
|
(./. + "/nixos/boxes/${hostname}")
|
|
|
|
(import ./nixos/email-accounts.nix)
|
2022-08-19 22:58:59 +01:00
|
|
|
(import ./nixos/common.nix)
|
2021-12-04 09:20:11 +00:00
|
|
|
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 = {
|
2022-03-10 12:25:23 +00:00
|
|
|
imports =
|
|
|
|
[ ./nixos/home-manager ./nixos/home-manager/linux.nix ];
|
2021-12-04 09:20:11 +00:00
|
|
|
_module.args.inputs = inputs;
|
2022-10-01 13:37:46 +01:00
|
|
|
_module.args.system = system;
|
2021-12-04 09:20:11 +00:00
|
|
|
};
|
|
|
|
}
|
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;
|
2022-10-23 10:51:00 +01:00
|
|
|
nixpkgs-nixos-stable-and-unfree = import nixpkgs-stable {
|
|
|
|
inherit system;
|
|
|
|
config = { allowUnfree = true; };
|
|
|
|
};
|
2022-03-08 00:17:06 +00:00
|
|
|
nixpkgs-nixos-unstable-and-unfree = import nixpkgs-nixos-unstable {
|
|
|
|
inherit system;
|
|
|
|
config = { allowUnfree = true; };
|
|
|
|
};
|
2022-02-20 15:57:58 +00:00
|
|
|
};
|
2021-12-04 09:20:11 +00:00
|
|
|
};
|
2022-10-29 21:22:35 +01:00
|
|
|
mkShell = packageSet: system:
|
|
|
|
let pkgs = packageSet.legacyPackages.${system};
|
|
|
|
in pkgs.mkShell {
|
|
|
|
packages = with pkgs; [
|
|
|
|
cacert
|
|
|
|
git
|
2022-12-03 17:22:57 +00:00
|
|
|
git-lfs
|
2022-10-29 21:22:35 +01:00
|
|
|
nixpkgs-fmt
|
|
|
|
openssh
|
|
|
|
openssl
|
|
|
|
pkg-config
|
|
|
|
statix
|
|
|
|
];
|
2022-05-01 19:11:04 +01:00
|
|
|
};
|
2022-10-29 21:22:35 +01:00
|
|
|
in {
|
|
|
|
devShells = {
|
|
|
|
"x86_64-darwin".default = mkShell nixpkgs-stable "x86_64-darwin";
|
|
|
|
"x86_64-linux".default = mkShell nixpkgs-stable "x86_64-linux";
|
|
|
|
};
|
2022-03-20 10:36:18 +00:00
|
|
|
darwinConfigurations = {
|
2022-10-05 13:29:09 +01:00
|
|
|
"FORM3-CYRYLPLOTN" = darwin.lib.darwinSystem rec {
|
2022-04-22 08:33:44 +01:00
|
|
|
system = "x86_64-darwin";
|
|
|
|
modules = [
|
|
|
|
(./. + "/nixos/boxes/form3")
|
|
|
|
home-manager.darwinModules.home-manager
|
|
|
|
{
|
|
|
|
home-manager.useGlobalPkgs = true;
|
|
|
|
home-manager.useUserPackages = true;
|
|
|
|
home-manager.users.cyryl = {
|
|
|
|
imports = [ ./nixos/home-manager ];
|
|
|
|
_module.args.inputs = inputs;
|
2022-10-05 13:29:09 +01:00
|
|
|
_module.args.system = system;
|
2022-04-22 08:33:44 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
2022-03-20 10:36:18 +00:00
|
|
|
};
|
2022-03-10 12:21:27 +00: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";
|
2022-03-05 14:34:27 +00:00
|
|
|
vpsfree1 = mkServer nixpkgs-stable "x86_64-linux" "vpsfree1";
|
2022-08-23 20:23:07 +01:00
|
|
|
yoga = mkKiosk nixpkgs-stable "x86_64-linux" "yoga";
|
2022-08-04 09:55:56 +01:00
|
|
|
homescreen = mkRaspi nixpkgs-stable "homescreen";
|
2021-12-04 10:43:02 +00:00
|
|
|
|
2022-03-02 22:46:45 +00:00
|
|
|
bootstrap = nixpkgs-stable.lib.nixosSystem rec {
|
2021-12-04 09:20:11 +00:00
|
|
|
system = "x86_64-linux";
|
2022-12-04 12:33:54 +00:00
|
|
|
modules = [ (./. + "/nixos/boxes/bootstrap") sops.nixosModules.sops ];
|
2022-03-02 22:46:45 +00:00
|
|
|
specialArgs = {
|
|
|
|
inherit inputs system;
|
2022-03-08 00:17:06 +00:00
|
|
|
nixpkgs-nixos-unstable-and-unfree = import nixpkgs-nixos-unstable {
|
|
|
|
inherit system;
|
|
|
|
config = { allowUnfree = true; };
|
|
|
|
};
|
2022-03-02 22:46:45 +00:00
|
|
|
};
|
2021-12-04 09:20:11 +00:00
|
|
|
};
|
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
|
2022-08-05 20:56:58 +01:00
|
|
|
# make sure to update eeprom https://nixos.wiki/wiki/NixOS_on_ARM/Raspberry_Pi_4#Board-specific_installation_notes
|
2021-12-04 10:43:02 +00:00
|
|
|
raspiimage = nixpkgs-stable.lib.nixosSystem {
|
|
|
|
system = "aarch64-linux";
|
|
|
|
modules = [
|
2022-03-08 00:17:06 +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
|
|
|
{
|
2022-08-04 09:55:56 +01:00
|
|
|
environment.systemPackages =
|
|
|
|
with nixpkgs-nixos-unstable.legacyPackages."aarch64-linux"; [
|
|
|
|
neovim
|
|
|
|
htop
|
|
|
|
btop
|
|
|
|
atop
|
|
|
|
];
|
|
|
|
|
2022-08-06 09:52:18 +01:00
|
|
|
networking.networkmanager.enable = false;
|
|
|
|
hardware.enableRedistributableFirmware = true;
|
|
|
|
networking.wireless.enable = true;
|
2022-08-04 09:55:56 +01:00
|
|
|
|
2021-12-04 10:43:02 +00:00
|
|
|
services.openssh = {
|
|
|
|
enable = true;
|
2022-03-08 00:17:06 +00:00
|
|
|
permitRootLogin =
|
2022-08-04 09:55:56 +01:00
|
|
|
nixpkgs-stable.lib.mkForce "prohibit-password";
|
2021-12-04 10:43:02 +00:00
|
|
|
passwordAuthentication = false;
|
|
|
|
};
|
2022-08-04 09:55:56 +01:00
|
|
|
|
|
|
|
services.xserver = {
|
|
|
|
enable = true;
|
2022-08-06 09:52:18 +01:00
|
|
|
displayManager.lightdm.enable = true;
|
2022-08-04 09:55:56 +01:00
|
|
|
desktopManager.gnome.enable = true;
|
2022-08-06 09:52:18 +01:00
|
|
|
libinput.enable = true;
|
2022-08-04 09:55:56 +01:00
|
|
|
};
|
|
|
|
|
2021-12-04 10:43:02 +00:00
|
|
|
users.extraUsers.root.openssh.authorizedKeys.keys = [
|
2022-07-31 09:35:01 +01:00
|
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEo4R+6J3h6Ix3xWpOMdU7Es1/YxFchHw0c+kcCOJxFb cyryl@foureighty"
|
2021-12-04 10:43:02 +00:00
|
|
|
];
|
|
|
|
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 = {
|
2022-07-03 18:50:30 +01:00
|
|
|
nixpkgs-master = {
|
|
|
|
type = "github";
|
|
|
|
owner = "NixOS";
|
|
|
|
repo = "nixpkgs";
|
|
|
|
ref = "master";
|
|
|
|
};
|
|
|
|
|
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";
|
2022-12-02 14:56:05 +00:00
|
|
|
ref = "nixos-22.11";
|
2021-05-31 09:15:44 +01:00
|
|
|
};
|
|
|
|
|
2021-06-12 09:40:09 +01:00
|
|
|
nixos-hardware = {
|
|
|
|
type = "github";
|
2021-06-13 09:54:53 +01:00
|
|
|
owner = "NixOS";
|
2021-06-12 09:40:09 +01:00
|
|
|
repo = "nixos-hardware";
|
2021-06-13 09:54:53 +01:00
|
|
|
ref = "master";
|
2021-06-12 09:40:09 +01:00
|
|
|
};
|
|
|
|
|
2022-03-10 12:21:27 +00:00
|
|
|
darwin = {
|
|
|
|
url = "github:lnl7/nix-darwin/master";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs-stable";
|
|
|
|
};
|
|
|
|
|
2021-05-30 20:41:33 +01:00
|
|
|
home-manager = {
|
|
|
|
type = "github";
|
|
|
|
owner = "nix-community";
|
|
|
|
repo = "home-manager";
|
2022-12-02 14:56:05 +00:00
|
|
|
ref = "release-22.11";
|
2022-05-28 20:06:00 +01:00
|
|
|
inputs.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";
|
|
|
|
};
|
|
|
|
|
2022-10-01 13:37:46 +01:00
|
|
|
nil = {
|
|
|
|
type = "github";
|
|
|
|
owner = "oxalica";
|
|
|
|
repo = "nil";
|
|
|
|
ref = "main";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs-nixos-unstable";
|
|
|
|
inputs.flake-utils.follows = "flake-utils";
|
|
|
|
};
|
|
|
|
|
2022-12-07 23:52:15 +00:00
|
|
|
helix = {
|
|
|
|
type = "github";
|
|
|
|
owner = "helix-editor";
|
|
|
|
repo = "helix";
|
|
|
|
ref = "22.12";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs-nixos-unstable";
|
|
|
|
};
|
2021-10-30 11:10:19 +01:00
|
|
|
sops = {
|
|
|
|
type = "github";
|
|
|
|
owner = "Mic92";
|
|
|
|
repo = "sops-nix";
|
|
|
|
ref = "master";
|
2022-06-04 08:40:14 +01:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs-stable";
|
2022-12-12 11:34:56 +00:00
|
|
|
inputs.nixpkgs-stable.follows = "nixpkgs-stable";
|
2021-10-30 11:10:19 +01:00
|
|
|
};
|
2022-02-20 16:23:55 +00:00
|
|
|
|
2022-11-08 16:28:34 +00:00
|
|
|
flake-compat = {
|
|
|
|
url = "github:edolstra/flake-compat";
|
|
|
|
flake = false;
|
|
|
|
};
|
2021-05-30 20:41:33 +01:00
|
|
|
};
|
2021-05-31 09:15:44 +01:00
|
|
|
|
2021-05-30 20:41:33 +01:00
|
|
|
}
|