Add docker

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2024-07-31 09:23:46 +01:00
parent af982a9f64
commit 8988398bff
10 changed files with 131 additions and 31 deletions

48
flake.lock generated
View File

@@ -28,11 +28,11 @@
]
},
"locked": {
"lastModified": 1721871128,
"narHash": "sha256-NyWVCnSeePnJHGJxZ0l3zdGQGrVjUcx2IJbV8KIsPf0=",
"lastModified": 1722217815,
"narHash": "sha256-8r5AJ3n8WEDw3rsZLALSuFQ5kJyWOcssNZvPxYLr2yc=",
"owner": "nix-community",
"repo": "disko",
"rev": "55e874b9c14764cb791e5740f0e92202e41393fc",
"rev": "1e6f8a7b4634fc051cc9361959bf414fcf17e094",
"type": "github"
},
"original": {
@@ -64,11 +64,11 @@
]
},
"locked": {
"lastModified": 1721900142,
"narHash": "sha256-iHIWZxwDfoqpNKxvjSzqzXNIPxI/5KgPmhtNrY2Z+40=",
"lastModified": 1722408750,
"narHash": "sha256-1nKAicPoQVrCcatj84LnAagtCeriztszBlmB2rllnT8=",
"owner": "karaolidis",
"repo": "home-manager",
"rev": "0828ae6830ae112ce36c8338e3223a751cefa05d",
"rev": "bd83e8a0c3b6af03eb9d9a22251c9e2145d2974c",
"type": "github"
},
"original": {
@@ -80,11 +80,11 @@
},
"impermanence": {
"locked": {
"lastModified": 1720000448,
"narHash": "sha256-43dq726JTKmjbvTaOJw35EnsoEnHWuFkQmY8wfXlefg=",
"lastModified": 1722269200,
"narHash": "sha256-Y2xSwoOw15rMVx9hWt05qHzwVOfhVN4WFnhk6sb6Bmo=",
"owner": "karaolidis",
"repo": "impermanence",
"rev": "48cb5ae525717ed5397607a2bf81c3fdda310a8f",
"rev": "702783a1c47e10c781b9e028b69d4d5999b03ca3",
"type": "github"
},
"original": {
@@ -96,16 +96,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1721928253,
"narHash": "sha256-xuLwutgAyYIwb2mmBJgWHTTfnS0lIDXVzjZUBK6d9hk=",
"owner": "NixOS",
"lastModified": 1722410387,
"narHash": "sha256-QLQoP9P5gFqcsheh7PSdJ58wKjpG+PF+gz/gPIqE79o=",
"owner": "karaolidis",
"repo": "nixpkgs",
"rev": "45cbf8d42fff56fcac72bbd31292eb381134be93",
"rev": "3d2d5810a4b7b8ad85b64a5bcfa0548ea04ba5ad",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "master",
"owner": "karaolidis",
"ref": "integration",
"repo": "nixpkgs",
"type": "github"
}
@@ -128,11 +128,11 @@
},
"nur": {
"locked": {
"lastModified": 1721983543,
"narHash": "sha256-6JmRrY7nIwKYadzJkolIXfGOC5JliYnB1EfGOY/Oh5g=",
"lastModified": 1722409351,
"narHash": "sha256-E4agC4tX1IsRupb5oq3cJiuxkwUjAg5FQMAMdtUYdWo=",
"owner": "nix-community",
"repo": "NUR",
"rev": "4807c89cf4ece6a96eed72957dcf0d9b8e29b052",
"rev": "efd6fc5b2df7748d3d7f51f70556031618ef4956",
"type": "github"
},
"original": {
@@ -161,11 +161,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1721688883,
"narHash": "sha256-9jsjsRKtJRqNSTXKj9zuDFRf2PGix30nMx9VKyPgD2U=",
"lastModified": 1722114803,
"narHash": "sha256-s6YhI8UHwQvO4cIFLwl1wZ1eS5Cuuw7ld2VzUchdFP0=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "aff2f88277dabe695de4773682842c34a0b7fd54",
"rev": "eb34eb588132d653e4c4925d862f1e5a227cc2ab",
"type": "github"
},
"original": {
@@ -182,11 +182,11 @@
]
},
"locked": {
"lastModified": 1722053480,
"narHash": "sha256-DG1jdoSIcRLkQvCs63MSMJmssHTwm4zGOmP3hUtAzSY=",
"lastModified": 1722399017,
"narHash": "sha256-yaOfEwUCOq+Kbk6seLkRzESdCqjStE0UzlqY3/+1XuE=",
"owner": "Gerg-L",
"repo": "spicetify-nix",
"rev": "e954f700aeaeb1b4df261c68c2391089f655fac8",
"rev": "66d84fe94ab17a86e146f0dbb53f96296dc57f39",
"type": "github"
},
"original": {

View File

@@ -2,15 +2,15 @@
inputs = {
nixpkgs = {
# --- Official
type = "github";
owner = "NixOS";
repo = "nixpkgs";
ref = "master";
# --- Fork
# type = "github";
# owner = "karaolidis";
# owner = "NixOS";
# repo = "nixpkgs";
# ref = "integration";
# ref = "master";
# --- Fork
type = "github";
owner = "karaolidis";
repo = "nixpkgs";
ref = "integration";
# --- Local
# url = "git+file:./submodules/nixpkgs";
};

View File

@@ -0,0 +1,24 @@
{ pkgs, ... }:
{
virtualisation.docker = {
enable = true;
enableOnBoot = false;
storageDriver = "btrfs";
daemon.settings = {
experimental = true;
ipv6 = true;
fixed-cidr-v6 = "fd00::/80";
};
autoPrune = {
enable = true;
flags = [ "--all" ];
};
};
environment = {
persistence."/persist".directories = [ "/var/lib/docker" ];
systemPackages = with pkgs; [ docker-compose ];
};
}

View File

@@ -0,0 +1,35 @@
{
username ? throw "username argument is required",
}:
{
config,
inputs,
pkgs,
...
}:
{
virtualisation.docker.rootless = {
enable = true;
setSocketVariable = true;
enableOnBoot = false;
storageDriver = "btrfs";
daemon.settings = {
experimental = true;
ipv6 = true;
fixed-cidr-v6 = "fd00::/80";
};
autoPrune = {
enable = true;
flags = [ "--all" ];
};
};
# This is not set though home-manager because we need to hide the mount
# otherwise docker complains with the following error:
# dockerd-rootless: failed to start daemon: error initializing graphdriver: prerequisites for driver not satisfied (wrong filesystem?): btrfs
environment.persistence."/persist".users.${username}.directories = [ ".local/share/docker" ];
home-manager.users.${username}.home.packages = with pkgs; [ docker-compose ];
}

View File

@@ -5,6 +5,7 @@
../common/system/configs/brightnessctl
../common/system/configs/btop
../common/system/configs/btrfs
../common/system/configs/docker
../common/system/configs/fastfetch
../common/system/configs/getty
../common/system/configs/git

View File

@@ -11,6 +11,7 @@ in
(import ../common/user/configs/console/bluetooth { inherit username; })
(import ../common/user/configs/console/brightnessctl { inherit username; })
(import ../common/user/configs/console/btop { inherit username; })
(import ../common/user/configs/console/docker { inherit username; })
(import ../common/user/configs/console/ffmpeg { inherit username; })
(import ../common/user/configs/console/git { inherit username; })
(import ../common/user/configs/console/gpg-agent { inherit username; })

1
submodules/nixpkgs Submodule

Submodule submodules/nixpkgs added at 6952047399

36
update-submodules.sh Executable file
View File

@@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
paths=$(git config --file .gitmodules --name-only --get-regexp path | while read -r line; do
path=$(git config --file .gitmodules --get "$line")
url=$(git config --file .gitmodules --get "${line%.*}.url")
if [[ $url == *"karaolidis"* ]]; then
echo "$path"
fi
done)
for path in $paths; do
echo "Processing submodule: $path"
cd "$path"
git checkout master
git fetch upstream
git merge upstream/master
branches=$(git for-each-ref --format='%(refname:short)' refs/heads/ | grep -v '^master$')
for branch in $branches; do
git checkout "$branch"
git rebase master
done
git checkout master
git push origin --all --force-with-lease
git push origin --tags --force-with-lease
cd - > /dev/null
done
echo "All submodules updated successfully."