update docker and podman config

This commit is contained in:
Gregory Burd 2023-10-16 14:46:06 -04:00
parent 2a9105a3ef
commit 4c4d84dba3
15 changed files with 91 additions and 44 deletions

View file

@ -70,7 +70,7 @@ signing, as well as for SSH'ing around.
Most relevant user apps daily drivers: Most relevant user apps daily drivers:
- neovim - emacs
- fish - fish
- kitty - kitty
- qutebrowser - qutebrowser

View file

@ -1,4 +1,3 @@
{ {
description = "Greg Burd's NixOS and Home Manager Configuration"; description = "Greg Burd's NixOS and Home Manager Configuration";
@ -42,7 +41,6 @@
}; };
outputs = outputs =
{ self { self
, fh
, nixpkgs , nixpkgs
, nix-formatter-pack , nix-formatter-pack
, ... , ...

View file

@ -1,3 +1,3 @@
{ desktop, lib, pkgs, ... }: { { pkgs, ... }: {
home.packages = [ pkgs.signal-desktop ]; home.packages = [ pkgs.signal-desktop ];
} }

View file

@ -148,7 +148,7 @@
plocate plocate
]; ];
sessionVariables = { sessionVariables = {
# PAGER = "moar"; # PAGER = "moar";
}; };
}; };
programs = { programs = {

View file

@ -3,7 +3,7 @@
{ pkgs, ... }: { { pkgs, ... }: {
imports = [ imports = [
./qt-style.nix ./qt-style.nix
# ../services/networkmanager.nix # ../services/networkmanager.nix
]; ];
# Exclude the elementary apps I don't use # Exclude the elementary apps I don't use

View file

@ -1,16 +1,16 @@
{ config, lib, pkgs, ...}: { { config, lib, pkgs, ... }: {
environment.systemPackages = with pkgs; environment.systemPackages = with pkgs;
[ [
clinfo clinfo
libva-utils libva-utils
python311Packages.gpustat python311Packages.gpustat
vdpauinfo vdpauinfo
] ++ (if lib.elem "nvidia" config.services.xserver.videoDrivers then ] ++ (if lib.elem "nvidia" config.services.xserver.videoDrivers then
[ [
nvtop nvtop
] ]
else else
[ [
nvtop-amd nvtop-amd
]); ]);
} }

View file

@ -1,3 +1,9 @@
# https://nixos.wiki/wiki/Impermanence
#
# https://nixos.wiki/wiki/Impermanence
# https://grahamc.com/blog/erase-your-darlings/
# https://lantian.pub/en/article/modify-computer/nixos-impermanence.lantian/
#
# This file defines the "non-hardware dependent" part of opt-in persistence # This file defines the "non-hardware dependent" part of opt-in persistence
# It imports impermanence, defines the basic persisted dirs, and ensures each # It imports impermanence, defines the basic persisted dirs, and ensures each
# users' home persist dir exists and has the right permissions # users' home persist dir exists and has the right permissions
@ -11,9 +17,10 @@
environment.persistence = { environment.persistence = {
"/persist" = { "/persist" = {
directories = [ directories = [
"/var/lib/containers"
"/var/lib/systemd" "/var/lib/systemd"
"/var/lib/nixos" "/var/lib/nixos"
# "/var/log" # "/var/log"
"/srv" "/srv"
]; ];
}; };

View file

@ -76,9 +76,8 @@ in
homeMode = "0755"; homeMode = "0755";
isNormalUser = true; isNormalUser = true;
# TODO
hashedPassword = "$6$RDOZHdTwt.BuOR4C$fYDkyb3yppbgX0ewPbsKabS2u9W.wyrRJONQPtugrO/gBJCzsWkfVIVYOAj07Qar1yqeYJBlBkYSFAgGe5ssw."; hashedPassword = "$6$RDOZHdTwt.BuOR4C$fYDkyb3yppbgX0ewPbsKabS2u9W.wyrRJONQPtugrO/gBJCzsWkfVIVYOAj07Qar1yqeYJBlBkYSFAgGe5ssw.";
#hashedPasswordFile = config.sops.secrets.gburd-password.path; # TODO: hashedPasswordFile = config.sops.secrets.gburd-password.path;
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
(builtins.readFile ../../../../home-manager/_mixins/users/gburd/ssh.pub) (builtins.readFile ../../../../home-manager/_mixins/users/gburd/ssh.pub)
(builtins.readFile ../../../../home-manager/_mixins/users/gburd/symas-ssh.pub) (builtins.readFile ../../../../home-manager/_mixins/users/gburd/symas-ssh.pub)

View file

@ -1,25 +1,24 @@
{ config, desktop, lib, pkgs, ... }: { { config, desktop, lib, pkgs, ... }: {
#https://nixos.wiki/wiki/Podman
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
unstable.distrobox
fuse-overlayfs fuse-overlayfs
podman-compose
podman-tui
] ++ lib.optionals (desktop != null) [ ] ++ lib.optionals (desktop != null) [
unstable.pods
unstable.quickemu unstable.quickemu
unstable.quickgui
xorg.xhost xorg.xhost
]; ];
virtualisation = { virtualisation = {
podman = { containers.enable = true;
defaultNetwork.settings = { containers.storage.settings = {
dns_enabled = true; storage = {
driver = "overlay";
runroot = "/run/containers/storage";
graphroot = "/var/lib/containers/storage";
rootless_storage_path = "/tmp/containers-$USER";
options.overlay.mountopt = "nodev,metacopy=on,acltype=posixacl";
}; };
dockerCompat = true;
dockerSocket.enable = true;
enable = true;
enableNvidia = lib.elem "nvidia" config.services.xserver.videoDrivers;
}; };
docker.storageDriver = "btrfs";
}; };
} }

View file

@ -0,0 +1,14 @@
{ pkgs, lib, config, ... }: {
# https://nixos.wiki/wiki/Docker
environment.systemPackages = with pkgs; [ docker-compose ];
virtualisation.docker = {
enable = true;
rootless = {
enable = true;
setSocketVariable = true;
};
};
}

View file

@ -0,0 +1,34 @@
{ config, desktop, lib, pkgs, ... }:
let
dockerEnabled = config.virtualisation.docker.enable;
in
{
# https://nixos.wiki/wiki/Podman
environment.systemPackages = with pkgs; [
unstable.distrobox
podman-compose
podman-tui
] ++ lib.optionals (desktop != null) [
unstable.pods
podman-desktop
];
virtualisation.podman = {
enable = true;
dockerCompat = !dockerEnabled;
dockerSocket.enable = !dockerEnabled;
defaultNetwork.settings.dns_enabled = true;
enableNvidia = lib.elem "nvidia" config.services.xserver.videoDrivers;
};
virtualisation.oci-containers.backend = lib.mkIf (!dockerEnabled) "podman";
environment.extraInit = lib.mkIf (!dockerEnabled)
''
if [ -z "$DOCKER_HOST" -a -n "$XDG_RUNTIME_DIR" ]; then
export DOCKER_HOST="unix://$XDG_RUNTIME_DIR/podman/podman.sock"
fi
'';
}

View file

@ -12,9 +12,8 @@
../_mixins/services/bluetooth.nix ../_mixins/services/bluetooth.nix
../_mixins/services/pipewire.nix ../_mixins/services/pipewire.nix
../_mixins/virt ../_mixins/virt
../_mixins/virt/docker.nix
# ../_mixins/global ../_mixins/virt/podman.nix
# ../_mixins/users/gburd
]; ];
boot = { boot = {

View file

@ -7,8 +7,7 @@
}; };
outputs = outputs =
{ self { nixpkgs
, nixpkgs
, flake-utils , flake-utils
}: }:

View file

@ -7,8 +7,7 @@
}; };
outputs = outputs =
{ self { nixpkgs
, nixpkgs
, flake-utils , flake-utils
}: }:

View file

@ -7,8 +7,7 @@
}; };
outputs = outputs =
{ self { nixpkgs
, nixpkgs
, flake-utils , flake-utils
}: }: