Disable home impermanence
This commit is contained in:
10
.gitignore
vendored
10
.gitignore
vendored
@@ -1,10 +0,0 @@
|
|||||||
# A list of files generated from README.org can be gathered and inserted by
|
|
||||||
# evaluating the following snippet:
|
|
||||||
# (mapc (lambda (target)
|
|
||||||
# (insert (concat (file-relative-name target)
|
|
||||||
# "\n")))
|
|
||||||
# (org-babel-tangle-file "README.org"))
|
|
||||||
|
|
||||||
hosts/nixos-testbed/configuration.nix
|
|
||||||
modules/system/impermanence.nix
|
|
||||||
flake.nix
|
|
||||||
|
|||||||
218
README.org
218
README.org
@@ -1,225 +1,11 @@
|
|||||||
#+PROPERTY: header-args :noweb no-export :results silent :comments both :tangle no
|
#+PROPERTY: header-args :noweb no-export :results silent :comments both :tangle no
|
||||||
#+STARTUP: overview
|
#+STARTUP: overview
|
||||||
#+title: Madeleine's dots for the literate (=sydnix=)
|
#+title: Madeleine's nest (=sydnix=)
|
||||||
|
|
||||||
* Top-level flake
|
|
||||||
|
|
||||||
#+begin_src nix :tangle flake.nix
|
|
||||||
{
|
|
||||||
description = "Madeleine's dots for the literate (sydnix)";
|
|
||||||
|
|
||||||
inputs = {
|
|
||||||
<<flake-inputs>>
|
|
||||||
|
|
||||||
disko.url = "github:nix-community/disko";
|
|
||||||
|
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
||||||
|
|
||||||
impermanence.url = "github:nix-community/impermanence";
|
|
||||||
|
|
||||||
home-manager = {
|
|
||||||
url = "github:nix-community/home-manager";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
outputs = { nixpkgs, ... }@inputs:
|
|
||||||
let list-nix-directory = dir:
|
|
||||||
builtins.attrNames
|
|
||||||
(nixpkgs.lib.filterAttrs
|
|
||||||
(k: _v: nixpkgs.lib.hasSuffix ".nix" k)
|
|
||||||
(builtins.readDir dir));
|
|
||||||
in {
|
|
||||||
# REVIEW: Why don't we put each module under nixosModules.<name>?
|
|
||||||
nixosModules.default =
|
|
||||||
let modules = list-nix-directory ./modules/nixos;
|
|
||||||
in { ... }: {
|
|
||||||
imports =
|
|
||||||
builtins.map (m: ./modules/nixos/${m}) modules;
|
|
||||||
};
|
|
||||||
|
|
||||||
homeManagerModules.default =
|
|
||||||
let modules = list-nix-directory ./modules/home;
|
|
||||||
in { ... }: {
|
|
||||||
imports =
|
|
||||||
builtins.map (m: ./modules/home/${m}) modules;
|
|
||||||
};
|
|
||||||
|
|
||||||
nixosConfigurations = (
|
|
||||||
<<flake-outputs-nixos>>
|
|
||||||
);
|
|
||||||
|
|
||||||
homeConfigurations =
|
|
||||||
let users = builtins.readDir ./users;
|
|
||||||
mkUser = username: _v: {
|
|
||||||
imports = [
|
|
||||||
(import ./users/${username}).home
|
|
||||||
|
|
||||||
inputs.self.homeManagerModules.default
|
|
||||||
|
|
||||||
({ lib, ... }: {
|
|
||||||
home.username = username;
|
|
||||||
})
|
|
||||||
|
|
||||||
inputs.impermanence.homeManagerModules.impermanence
|
|
||||||
];
|
|
||||||
};
|
|
||||||
in
|
|
||||||
builtins.mapAttrs mkUser users;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
* Machines
|
|
||||||
|
|
||||||
For every ~./hosts/NAME/configuration.nix~, define the system under the name ~NAME~.
|
|
||||||
|
|
||||||
#+begin_src nix :noweb-ref flake-outputs-nixos
|
|
||||||
let mkHost = k: v: nixpkgs.lib.nixosSystem {
|
|
||||||
specialArgs = inputs;
|
|
||||||
system = import ./hosts/${k}/system.nix;
|
|
||||||
modules = [
|
|
||||||
./hosts/${k}/configuration.nix
|
|
||||||
|
|
||||||
inputs.self.nixosModules.default
|
|
||||||
|
|
||||||
inputs.disko.nixosModules.disko
|
|
||||||
inputs.impermanence.nixosModules.impermanence
|
|
||||||
|
|
||||||
# Directory name should always match host name.
|
|
||||||
({ ... }: { networking.hostName = k; })
|
|
||||||
|
|
||||||
# home-manager configuration.
|
|
||||||
inputs.home-manager.nixosModules.home-manager
|
|
||||||
({ config, lib, self, ... }: {
|
|
||||||
home-manager.useGlobalPkgs = true;
|
|
||||||
home-manager.useUserPackages = true;
|
|
||||||
|
|
||||||
home-manager.users =
|
|
||||||
lib.filterAttrs
|
|
||||||
(k: _v: builtins.elem k config.sydnix.users.users)
|
|
||||||
self.homeConfigurations;
|
|
||||||
|
|
||||||
home-manager.extraSpecialArgs = inputs // { inherit self; };
|
|
||||||
})
|
|
||||||
];
|
|
||||||
};
|
|
||||||
in
|
|
||||||
builtins.mapAttrs mkHost (builtins.readDir ./hosts)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** =nixos-testbed=
|
|
||||||
|
|
||||||
#+begin_src nix :tangle hosts/nixos-testbed/configuration.nix
|
|
||||||
{ config, pkgs, lib, disko, ... }:
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
./hardware-configuration.nix
|
|
||||||
./disko-config.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
sydnix = {
|
|
||||||
impermanence = {
|
|
||||||
enable = true;
|
|
||||||
directories = [
|
|
||||||
# Warning: Neither /var/lib/nixos nor any of its parents are persisted.
|
|
||||||
# This means all users/groups without specified uids/gids will have them
|
|
||||||
# reassigned on reboot.
|
|
||||||
"/var/lib/nixos"
|
|
||||||
];
|
|
||||||
rollbackTo = "blank";
|
|
||||||
dataset = "rpool/local/home";
|
|
||||||
archiveLimit = 3;
|
|
||||||
};
|
|
||||||
users.users = [
|
|
||||||
"crumb"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
boot = {
|
|
||||||
initrd = {
|
|
||||||
enable = true;
|
|
||||||
systemd.enable = true;
|
|
||||||
|
|
||||||
systemd.initrdBin = with pkgs; [
|
|
||||||
zfs
|
|
||||||
coreutils
|
|
||||||
babashka
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
loader = {
|
|
||||||
systemd-boot.enable = true;
|
|
||||||
efi.canTouchEfiVariables = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# networking.hostName = "nixos-testbed";
|
|
||||||
networking.hostId = "238e9b1e"; # head -c 8 /etc/machine-id
|
|
||||||
|
|
||||||
time.timeZone = "America/Denver";
|
|
||||||
|
|
||||||
i18n.defaultLocale = "en_US.UTF-8";
|
|
||||||
|
|
||||||
console = {
|
|
||||||
font = "Lat2-Terminus16";
|
|
||||||
# keyMap = "us";
|
|
||||||
useXkbConfig = true; # use xkb.options in tty.
|
|
||||||
};
|
|
||||||
|
|
||||||
services.xserver.enable = true;
|
|
||||||
# services.displayManager.sddm.enable = true;
|
|
||||||
# services.desktopManager.plasma6.enable = true;
|
|
||||||
|
|
||||||
services.xserver.xkb.layout = "us";
|
|
||||||
services.xserver.xkb.options = "caps:escape";
|
|
||||||
|
|
||||||
users.users.crumb = {
|
|
||||||
isNormalUser = true;
|
|
||||||
extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
|
|
||||||
# Change this immediately after installation!
|
|
||||||
initialPassword = "password123";
|
|
||||||
};
|
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
neovim
|
|
||||||
];
|
|
||||||
|
|
||||||
services.openssh.enable = true;
|
|
||||||
services.openssh.settings.PermitRootLogin = "yes";
|
|
||||||
|
|
||||||
# This option defines the first version of NixOS you have installed on this
|
|
||||||
# particular machine, and is used to maintain compatibility with application
|
|
||||||
# data (e.g. databases) created on older NixOS versions.
|
|
||||||
#
|
|
||||||
# Most users should NEVER change this value after the initial install, for any
|
|
||||||
# reason, even if you've upgraded your system to a new NixOS release.
|
|
||||||
#
|
|
||||||
# This value does NOT affect the Nixpkgs version your packages and OS are
|
|
||||||
# pulled from, so changing it will NOT upgrade your system - see
|
|
||||||
# https://nixos.org/manual/nixos/stable/#sec-upgrading for how to actually do
|
|
||||||
# that.
|
|
||||||
#
|
|
||||||
# This value being lower than the current NixOS release does NOT mean your
|
|
||||||
# system is out of date, out of support, or vulnerable.
|
|
||||||
#
|
|
||||||
# Do NOT change this value unless you have manually inspected all the changes
|
|
||||||
# it would make to your configuration, and migrated your data accordingly.
|
|
||||||
#
|
|
||||||
# For more information, see `man configuration.nix` or
|
|
||||||
# https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
|
|
||||||
system.stateVersion = "24.05"; # Did you read the comment?
|
|
||||||
}
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** =guix-rebound=
|
|
||||||
|
|
||||||
The primary desktop of a girl done with her plebian phase, and done with Guix's
|
|
||||||
bullshit.
|
|
||||||
|
|
||||||
* References
|
* References
|
||||||
|
|
||||||
- My darling dearest Faye's =wishsys= }:D
|
- My darling dearest Faye's =wishsys= }:D
|
||||||
- [[https://github.com/rasendubi/dotfiles][rasendubi/dotfiles]]
|
- [[https://github.com/rasendubi/dotfiles][rasendubi/dotfiles]]
|
||||||
|
- [[https://git.mangoiv.com/mangoiv/dotfiles][magoiv/dotfiles]]
|
||||||
- [[https://github.com/hlissner/dotfiles/][hlissner/dotfiles]]
|
- [[https://github.com/hlissner/dotfiles/][hlissner/dotfiles]]
|
||||||
- [[https://github.com/Shawn8901/nix-configuration/tree/af71d51998a6772a300f842795b947e27202fa73][Shawn8901/nix-configuration]]
|
- [[https://github.com/Shawn8901/nix-configuration/tree/af71d51998a6772a300f842795b947e27202fa73][Shawn8901/nix-configuration]]
|
||||||
|
|||||||
159
flake.lock
generated
159
flake.lock
generated
@@ -1,5 +1,23 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"disko": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1734088167,
|
||||||
|
"narHash": "sha256-OIitVU+IstPbX/NWn2jLF+/sT9dVKcO2FKeRAzlyX6c=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "disko",
|
||||||
|
"rev": "d32f2d1750d61a476a236526b725ec5a32e16342",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "disko",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"home-manager": {
|
"home-manager": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
@@ -35,7 +53,111 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"niri": {
|
||||||
|
"inputs": {
|
||||||
|
"niri-stable": "niri-stable",
|
||||||
|
"niri-unstable": "niri-unstable",
|
||||||
|
"nixpkgs": "nixpkgs_2",
|
||||||
|
"nixpkgs-stable": "nixpkgs-stable",
|
||||||
|
"xwayland-satellite-stable": "xwayland-satellite-stable",
|
||||||
|
"xwayland-satellite-unstable": "xwayland-satellite-unstable"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1734280237,
|
||||||
|
"narHash": "sha256-+dtkltYnfqR8R78YGkzn/kBn3sRAQEN5L7PWP0A0x/U=",
|
||||||
|
"owner": "sodiboo",
|
||||||
|
"repo": "niri-flake",
|
||||||
|
"rev": "8d87a092be1823ab5a9dfb9c94cc98d151302a6a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "sodiboo",
|
||||||
|
"repo": "niri-flake",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"niri-stable": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1731483594,
|
||||||
|
"narHash": "sha256-Qjf7alRbPPERfiZsM9EMKX+HwjESky1tieh5PJIkLwE=",
|
||||||
|
"owner": "YaLTeR",
|
||||||
|
"repo": "niri",
|
||||||
|
"rev": "75c79116a7e40cbc0e110ce0cdd500e896458679",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "YaLTeR",
|
||||||
|
"ref": "v0.1.10.1",
|
||||||
|
"repo": "niri",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"niri-unstable": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1734270275,
|
||||||
|
"narHash": "sha256-FfpxEVDPQ1qSDoLOqnSK2laM6oPklgZhd2YWzxOB8Ns=",
|
||||||
|
"owner": "YaLTeR",
|
||||||
|
"repo": "niri",
|
||||||
|
"rev": "d35ad73e3572b0ac704b0c08928f53d0cfd1951f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "YaLTeR",
|
||||||
|
"repo": "niri",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1733749988,
|
||||||
|
"narHash": "sha256-+5qdtgXceqhK5ZR1YbP1fAUsweBIrhL38726oIEAtDs=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "bc27f0fde01ce4e1bfec1ab122d72b7380278e68",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-stable": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1734017764,
|
||||||
|
"narHash": "sha256-msOfmyJSjAHgIygI/JD0Ae3JsDv4rT54Nlfr5t6MQMQ=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "64e9404f308e0f0a0d8cdd7c358f74e34802494b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-24.05",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1734119587,
|
||||||
|
"narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_3": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1731245184,
|
"lastModified": 1731245184,
|
||||||
"narHash": "sha256-vmLS8+x+gHRv1yzj3n+GTAEObwmhxmkkukB2DwtJRdU=",
|
"narHash": "sha256-vmLS8+x+gHRv1yzj3n+GTAEObwmhxmkkukB2DwtJRdU=",
|
||||||
@@ -53,9 +175,44 @@
|
|||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"disko": "disko",
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"impermanence": "impermanence",
|
"impermanence": "impermanence",
|
||||||
"nixpkgs": "nixpkgs"
|
"niri": "niri",
|
||||||
|
"nixpkgs": "nixpkgs_3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"xwayland-satellite-stable": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1730166465,
|
||||||
|
"narHash": "sha256-nq7bouXQXaaPPo/E+Jbq+wNHnatD4dY8OxSrRqzvy6s=",
|
||||||
|
"owner": "Supreeeme",
|
||||||
|
"repo": "xwayland-satellite",
|
||||||
|
"rev": "a713cf46cb7db84a0d1b57c3a397c610cad3cf98",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "Supreeeme",
|
||||||
|
"ref": "v0.5",
|
||||||
|
"repo": "xwayland-satellite",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"xwayland-satellite-unstable": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1734112800,
|
||||||
|
"narHash": "sha256-9qSb6AJpmzV3oYRfsyEt0e9eju6UeXDSD1poeSwadKo=",
|
||||||
|
"owner": "Supreeeme",
|
||||||
|
"repo": "xwayland-satellite",
|
||||||
|
"rev": "c45c2ed990912c26e6aed0f47bfddb03993d7999",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "Supreeeme",
|
||||||
|
"repo": "xwayland-satellite",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
130
flake.nix
Normal file
130
flake.nix
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
{
|
||||||
|
description = "Madeleine's dots for the illiterate (sydnix)";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
disko.url = "github:nix-community/disko";
|
||||||
|
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
|
|
||||||
|
impermanence.url = "github:nix-community/impermanence";
|
||||||
|
|
||||||
|
home-manager = {
|
||||||
|
url = "github:nix-community/home-manager";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
niri.url = "github:sodiboo/niri-flake";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { nixpkgs, ... }@inputs:
|
||||||
|
let list-nix-directory = dir:
|
||||||
|
builtins.attrNames
|
||||||
|
(nixpkgs.lib.filterAttrs
|
||||||
|
(k: _v: nixpkgs.lib.hasSuffix ".nix" k)
|
||||||
|
(builtins.readDir dir));
|
||||||
|
in {
|
||||||
|
# REVIEW: Why don't we put each module under nixosModules.<name>?
|
||||||
|
nixosModules.default =
|
||||||
|
let modules = list-nix-directory ./modules/nixos;
|
||||||
|
in { ... }: {
|
||||||
|
imports =
|
||||||
|
builtins.map (m: ./modules/nixos/${m}) modules;
|
||||||
|
};
|
||||||
|
|
||||||
|
homeManagerModules.default =
|
||||||
|
let modules = list-nix-directory ./modules/home;
|
||||||
|
in { ... }: {
|
||||||
|
imports =
|
||||||
|
builtins.map (m: ./modules/home/${m}) modules;
|
||||||
|
};
|
||||||
|
|
||||||
|
nixosConfigurations = (
|
||||||
|
let mkHost = k: v: nixpkgs.lib.nixosSystem {
|
||||||
|
specialArgs = inputs;
|
||||||
|
system = import ./hosts/${k}/system.nix;
|
||||||
|
# TODO: This is very ad-hoc, and I don't like it. Organise this better.
|
||||||
|
modules = [
|
||||||
|
./hosts/${k}/configuration.nix
|
||||||
|
|
||||||
|
inputs.self.nixosModules.default
|
||||||
|
|
||||||
|
inputs.disko.nixosModules.disko
|
||||||
|
inputs.impermanence.nixosModules.impermanence
|
||||||
|
|
||||||
|
# Directory name should always match host name.
|
||||||
|
({ ... }: { networking.hostName = k; })
|
||||||
|
|
||||||
|
# Get system users
|
||||||
|
({ config, lib, ... }: {
|
||||||
|
users.users =
|
||||||
|
(lib.mapAttrs
|
||||||
|
(k: v: (import ./users/${k}).systemUser)
|
||||||
|
(lib.filterAttrs
|
||||||
|
(k: _v: builtins.elem k config.sydnix.users.users)
|
||||||
|
(builtins.readDir ./users)));
|
||||||
|
})
|
||||||
|
|
||||||
|
# Nixpkgs configuration
|
||||||
|
({ pkgs, ... }: {
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
|
documentation = {
|
||||||
|
man.enable = true;
|
||||||
|
info.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
man-pages
|
||||||
|
stdman
|
||||||
|
man-pages-posix
|
||||||
|
stdmanpages
|
||||||
|
];
|
||||||
|
})
|
||||||
|
|
||||||
|
# home-manager configuration.
|
||||||
|
inputs.home-manager.nixosModules.home-manager
|
||||||
|
({ config, lib, self, ... }: {
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
|
||||||
|
home-manager.users =
|
||||||
|
lib.filterAttrs
|
||||||
|
(k: _v: builtins.elem k config.sydnix.users.users)
|
||||||
|
self.homeConfigurations;
|
||||||
|
|
||||||
|
home-manager.extraSpecialArgs = inputs // { inherit self; };
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
in
|
||||||
|
builtins.mapAttrs mkHost (builtins.readDir ./hosts)
|
||||||
|
);
|
||||||
|
|
||||||
|
homeConfigurations =
|
||||||
|
let users = builtins.readDir ./users;
|
||||||
|
mkUser = username: _v: {
|
||||||
|
# TODO: This is very ad-hoc, and I don't like it. Organise this better.
|
||||||
|
imports = [
|
||||||
|
(import ./users/${username}).home
|
||||||
|
|
||||||
|
inputs.self.homeManagerModules.default
|
||||||
|
|
||||||
|
({ lib, ... }: {
|
||||||
|
home.username = username;
|
||||||
|
})
|
||||||
|
|
||||||
|
({ pkgs, lib, ... }: {
|
||||||
|
nix = {
|
||||||
|
settings.experimental-features =
|
||||||
|
lib.mkDefault
|
||||||
|
[ "nix-command" "flakes" ];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
inputs.impermanence.homeManagerModules.impermanence
|
||||||
|
];
|
||||||
|
};
|
||||||
|
in
|
||||||
|
builtins.mapAttrs mkUser users;
|
||||||
|
};
|
||||||
|
}
|
||||||
103
hosts/nixos-testbed/configuration.nix
Normal file
103
hosts/nixos-testbed/configuration.nix
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
{ config, pkgs, lib, disko, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./hardware-configuration.nix
|
||||||
|
./disko-config.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
sydnix = {
|
||||||
|
impermanence = {
|
||||||
|
enable = true;
|
||||||
|
directories = [
|
||||||
|
# Warning: Neither /var/lib/nixos nor any of its parents are persisted.
|
||||||
|
# This means all users/groups without specified uids/gids will have them
|
||||||
|
# reassigned on reboot.
|
||||||
|
"/var/lib/nixos"
|
||||||
|
"/etc/ssh"
|
||||||
|
];
|
||||||
|
rollbackTo = "blank";
|
||||||
|
dataset = "rpool/local/home";
|
||||||
|
archiveLimit = 3;
|
||||||
|
};
|
||||||
|
users.users = [
|
||||||
|
"crumb"
|
||||||
|
];
|
||||||
|
# niri.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
boot = {
|
||||||
|
initrd = {
|
||||||
|
enable = true;
|
||||||
|
systemd.enable = true;
|
||||||
|
|
||||||
|
systemd.initrdBin = with pkgs; [
|
||||||
|
zfs
|
||||||
|
coreutils
|
||||||
|
babashka
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
loader = {
|
||||||
|
systemd-boot.enable = true;
|
||||||
|
efi.canTouchEfiVariables = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# networking.hostName = "nixos-testbed";
|
||||||
|
networking.hostId = "238e9b1e"; # head -c 8 /etc/machine-id
|
||||||
|
|
||||||
|
time.timeZone = "America/Denver";
|
||||||
|
|
||||||
|
i18n.defaultLocale = "en_US.UTF-8";
|
||||||
|
|
||||||
|
console = {
|
||||||
|
font = "Lat2-Terminus16";
|
||||||
|
# keyMap = "us";
|
||||||
|
useXkbConfig = true; # use xkb.options in tty.
|
||||||
|
};
|
||||||
|
|
||||||
|
services.xserver.enable = true;
|
||||||
|
services.displayManager.sddm.enable = true;
|
||||||
|
services.desktopManager.plasma6.enable = true;
|
||||||
|
|
||||||
|
services.xserver.xkb.layout = "us";
|
||||||
|
services.xserver.xkb.options = "caps:escape";
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
neovim
|
||||||
|
git
|
||||||
|
];
|
||||||
|
|
||||||
|
services.openssh.enable = true;
|
||||||
|
services.openssh.settings.PermitRootLogin = "yes";
|
||||||
|
|
||||||
|
# services.xserver.windowManager.qtile = {
|
||||||
|
# enable = true;
|
||||||
|
# extraPackages = python3Packages: with python3Packages; [
|
||||||
|
# qtile-extras
|
||||||
|
# hy
|
||||||
|
# ];
|
||||||
|
# };
|
||||||
|
|
||||||
|
# This option defines the first version of NixOS you have installed on this
|
||||||
|
# particular machine, and is used to maintain compatibility with application
|
||||||
|
# data (e.g. databases) created on older NixOS versions.
|
||||||
|
#
|
||||||
|
# Most users should NEVER change this value after the initial install, for any
|
||||||
|
# reason, even if you've upgraded your system to a new NixOS release.
|
||||||
|
#
|
||||||
|
# This value does NOT affect the Nixpkgs version your packages and OS are
|
||||||
|
# pulled from, so changing it will NOT upgrade your system - see
|
||||||
|
# https://nixos.org/manual/nixos/stable/#sec-upgrading for how to actually do
|
||||||
|
# that.
|
||||||
|
#
|
||||||
|
# This value being lower than the current NixOS release does NOT mean your
|
||||||
|
# system is out of date, out of support, or vulnerable.
|
||||||
|
#
|
||||||
|
# Do NOT change this value unless you have manually inspected all the changes
|
||||||
|
# it would make to your configuration, and migrated your data accordingly.
|
||||||
|
#
|
||||||
|
# For more information, see `man configuration.nix` or
|
||||||
|
# https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
|
||||||
|
system.stateVersion = "24.05"; # Did you read the comment?
|
||||||
|
}
|
||||||
@@ -7,10 +7,34 @@ let
|
|||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
sydnix.impermanence = {
|
sydnix.impermanence = {
|
||||||
enable = mkOption {
|
enable = mkEnableOption "impermanence";
|
||||||
description = "Enable Impermanence";
|
|
||||||
type = types.bool;
|
mutableDotfiles = {
|
||||||
default = false;
|
enable = mkEnableOption "dotfiles under impermanence";
|
||||||
|
|
||||||
|
# storeAt = mkOption {
|
||||||
|
# default = "dots/config";
|
||||||
|
# type = types.str;
|
||||||
|
# # type = with types;
|
||||||
|
# # addCheck
|
||||||
|
# # path
|
||||||
|
# # (x: cfg.mutableDotfiles.enable
|
||||||
|
# # -> ! (elem x cfg.mutableDotfiles.directories));
|
||||||
|
# };
|
||||||
|
|
||||||
|
files = mkOption {
|
||||||
|
default = [];
|
||||||
|
# FIXME: Inaccurate type.
|
||||||
|
type = with types;
|
||||||
|
listOf anything;
|
||||||
|
};
|
||||||
|
|
||||||
|
directories = mkOption {
|
||||||
|
default = [];
|
||||||
|
# FIXME: Inaccurate type.
|
||||||
|
type = with types;
|
||||||
|
listOf anything;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
directories = mkOption {
|
directories = mkOption {
|
||||||
@@ -28,10 +52,22 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.persistence."/persist/home/${config.home.username}" = {
|
home.persistence = {
|
||||||
|
"/persist/home/${config.home.username}" = {
|
||||||
allowOther = true;
|
allowOther = true;
|
||||||
directories = cfg.directories;
|
directories = cfg.directories;
|
||||||
files = cfg.files;
|
files = cfg.files;
|
||||||
};
|
};
|
||||||
|
} // (if ! cfg.mutableDotfiles.enable
|
||||||
|
then {}
|
||||||
|
else {
|
||||||
|
"/persist/dots/users/${config.home.username}/dots/" = {
|
||||||
|
removePrefixDirectory = true;
|
||||||
|
directories = cfg.mutableDotfiles.directories;
|
||||||
|
files = cfg.mutableDotfiles.files;
|
||||||
|
allowOther = true;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
#!/usr/bin/env bb
|
#!/usr/bin/env bb
|
||||||
|
|
||||||
;;; TODO: rewrite with fewer assumptions about the filesystem structure.
|
;; TODO: rewrite with fewer assumptions about the filesystem structure. Perhaps
|
||||||
|
;; we can achieve near-atomicity by doing to bulk of the work with a function
|
||||||
|
;; `erase-home-darlings : FileSystem -> Maybe FileSystem`, which will not do any
|
||||||
|
;; IO.
|
||||||
|
|
||||||
;;; TODO: option to either move OR copy
|
;; TODO: option to either move OR copy
|
||||||
|
|
||||||
(require '[clojure.core.match :refer [match]]
|
(require '[clojure.core.match :refer [match]]
|
||||||
'[babashka.cli :as cli]
|
'[babashka.cli :as cli]
|
||||||
'[clojure.pprint :as pp]
|
'[clojure.pprint :as pp]
|
||||||
|
'[clojure.tools.logging :as l]
|
||||||
'[babashka.process :refer [shell check process] :as p])
|
'[babashka.process :refer [shell check process] :as p])
|
||||||
|
|
||||||
(defn get-files [{:keys [rollback-to dataset]}]
|
(defn get-files [{:keys [rollback-to dataset]}]
|
||||||
;; (prn rollback-to)
|
|
||||||
;; (prn dataset)
|
|
||||||
(let [snapshot (str dataset "@" rollback-to)
|
(let [snapshot (str dataset "@" rollback-to)
|
||||||
diff (:out (shell {:out :string}
|
diff (:out (shell {:out :string}
|
||||||
"zfs diff -HF"
|
"zfs diff -HF"
|
||||||
@@ -139,9 +141,27 @@ More precisely,
|
|||||||
(defn -main [opts]
|
(defn -main [opts]
|
||||||
(pp/pprint opts)
|
(pp/pprint opts)
|
||||||
(with-echoed-shell-commands
|
(with-echoed-shell-commands
|
||||||
|
(shell "mount" (:dataset opts) "/home")
|
||||||
(let [files (get-files opts)]
|
(let [files (get-files opts)]
|
||||||
(archive-files opts files)
|
(archive-files opts files)
|
||||||
(cycle-archives opts)
|
(cycle-archives opts)
|
||||||
(do-rollback opts))))
|
(do-rollback opts))))
|
||||||
|
|
||||||
|
#_
|
||||||
|
(def fs-ops
|
||||||
|
{:zfs {:get-files zfs-get-files
|
||||||
|
:rollback zfs-rollback}})
|
||||||
|
|
||||||
|
#_
|
||||||
|
(defn -main [opts]
|
||||||
|
(let [test-bin (fn [x]
|
||||||
|
(printf "%s: %s\n"
|
||||||
|
x (map str (fs/which-all x))))]
|
||||||
|
(test-bin "mount")
|
||||||
|
(test-bin "findmnt")
|
||||||
|
(test-bin "zfs"))
|
||||||
|
|
||||||
|
(shell "mount")
|
||||||
|
(shell "ls -la /home"))
|
||||||
|
|
||||||
(-main (cli/parse-opts *command-line-args* cli-spec))
|
(-main (cli/parse-opts *command-line-args* cli-spec))
|
||||||
|
|||||||
@@ -20,6 +20,11 @@ in {
|
|||||||
default = [];
|
default = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
persistGroupName = mkOption {
|
||||||
|
default = "persist";
|
||||||
|
type = types.str;
|
||||||
|
};
|
||||||
|
|
||||||
files = mkOption {
|
files = mkOption {
|
||||||
description = "";
|
description = "";
|
||||||
|
|
||||||
@@ -45,10 +50,28 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
users.groups.${cfg.persistGroupName} = {
|
||||||
|
name = cfg.persistGroupName;
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.tmpfiles.settings = {
|
||||||
|
"10-persist" = {
|
||||||
|
"/persist" = {
|
||||||
|
z = {
|
||||||
|
group = cfg.persistGroupName;
|
||||||
|
mode = "2775";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
boot.initrd.systemd.initrdBin = with pkgs; [
|
boot.initrd.systemd.initrdBin = with pkgs; [
|
||||||
zfs
|
zfs
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# TODO: Move this somewhere else.
|
||||||
|
programs.fuse.userAllowOther = true;
|
||||||
|
|
||||||
boot.initrd.systemd.services.erase-darlings =
|
boot.initrd.systemd.services.erase-darlings =
|
||||||
let service = {
|
let service = {
|
||||||
description = "Rollback filesystem to a blank state on boot";
|
description = "Rollback filesystem to a blank state on boot";
|
||||||
@@ -77,16 +100,20 @@ in {
|
|||||||
then service
|
then service
|
||||||
else throw "sydnix.impermanence currently requires config.boot.initrd.systemd.enable'!";
|
else throw "sydnix.impermanence currently requires config.boot.initrd.systemd.enable'!";
|
||||||
|
|
||||||
systemd.services.erase-home-darlings = {
|
systemd.services =
|
||||||
|
let erase-home-darlings = {
|
||||||
description = "Rollback home to a blank state on boot";
|
description = "Rollback home to a blank state on boot";
|
||||||
wantedBy = [
|
wantedBy = [
|
||||||
"multi-user.target"
|
"local-fs-pre.target"
|
||||||
|
"zfs-mount.service"
|
||||||
];
|
];
|
||||||
after = [
|
before = [
|
||||||
"home.mount"
|
"local-fs.target"
|
||||||
|
"local-fs-pre.target"
|
||||||
|
"zfs-mount.service"
|
||||||
];
|
];
|
||||||
path = [ pkgs.zfs pkgs.babashka ];
|
path = [ pkgs.zfs pkgs.babashka pkgs.util-linux ];
|
||||||
# unitConfig.DefaultDependencies = "no";
|
unitConfig.DefaultDependencies = "no";
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
RemainAfterExit = true;
|
RemainAfterExit = true;
|
||||||
@@ -97,8 +124,11 @@ in {
|
|||||||
stopIfChanged = false;
|
stopIfChanged = false;
|
||||||
restartIfChanged = false;
|
restartIfChanged = false;
|
||||||
};
|
};
|
||||||
|
in {
|
||||||
|
# inherit erase-home-darlings;
|
||||||
|
};
|
||||||
|
|
||||||
environment.persistence."/persist" = {
|
environment.persistence."/persist/root" = {
|
||||||
directories = cfg.directories;
|
directories = cfg.directories;
|
||||||
files = cfg.files;
|
files = cfg.files;
|
||||||
};
|
};
|
||||||
|
|||||||
51
modules/nixos/niri.nix
Normal file
51
modules/nixos/niri.nix
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
{ config, lib, pkgs, niri, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.sydnix.niri;
|
||||||
|
in {
|
||||||
|
options = {
|
||||||
|
sydnix.niri = {
|
||||||
|
enable = mkEnableOption "Niri";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
niri.nixosModules.niri
|
||||||
|
];
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
|
programs.niri = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
services.pipewire.enable = true;
|
||||||
|
|
||||||
|
# programs.niri.enable = true;
|
||||||
|
|
||||||
|
# hardware = {
|
||||||
|
# graphics = {
|
||||||
|
# enable = true;
|
||||||
|
# extraPackages = with pkgs; [
|
||||||
|
# intel-media-sdk
|
||||||
|
# mesa
|
||||||
|
# ];
|
||||||
|
# enable32Bit = true;
|
||||||
|
# };
|
||||||
|
# nvidia = {
|
||||||
|
# open = false;
|
||||||
|
# modesetting.enable = true;
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
|
||||||
|
# environment.systemPackages = with pkgs; [
|
||||||
|
# fuzzel
|
||||||
|
# ];
|
||||||
|
|
||||||
|
# services.xserver.videoDrivers = [ "qxl" "nvidia" ];
|
||||||
|
# services.qemuGuest.enable = true;
|
||||||
|
# services.spice-vdagentd.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,12 +1,38 @@
|
|||||||
{
|
{
|
||||||
|
systemUser = {
|
||||||
|
isNormalUser = true;
|
||||||
|
extraGroups = [ "wheel" "persist" ];
|
||||||
|
# Change this immediately after installation!
|
||||||
|
initialPassword = "password123";
|
||||||
|
};
|
||||||
|
|
||||||
home = { config, lib, pkgs, ... }: {
|
home = { config, lib, pkgs, ... }: {
|
||||||
sydnix.impermanence = {
|
sydnix.impermanence = {
|
||||||
enable = true;
|
enable = false;
|
||||||
|
|
||||||
|
directories = [
|
||||||
|
# ".ssh"
|
||||||
|
# ".config/systemd"
|
||||||
|
];
|
||||||
|
|
||||||
|
mutableDotfiles = {
|
||||||
|
enable = false;
|
||||||
|
# files = [
|
||||||
|
# "nvim/.config/nvim/init.vim"
|
||||||
|
# "nvim/.vimrc"
|
||||||
|
# ];
|
||||||
|
# directories = [
|
||||||
|
# "qtile"
|
||||||
|
# ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
home = {
|
home = {
|
||||||
stateVersion = "18.09";
|
stateVersion = "18.09";
|
||||||
packages = [ pkgs.hello ];
|
packages = [
|
||||||
|
pkgs.hello
|
||||||
|
# pkgs.wezterm
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
1
users/crumb/dots/nvim/.config/nvim/init.vim
Normal file
1
users/crumb/dots/nvim/.config/nvim/init.vim
Normal file
@@ -0,0 +1 @@
|
|||||||
|
so ~/.vimrc
|
||||||
2
users/crumb/dots/nvim/.vimrc
Normal file
2
users/crumb/dots/nvim/.vimrc
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
imap jk <ESC>
|
||||||
|
xmap JK <ESC>
|
||||||
Reference in New Issue
Block a user