Don't use nix-channels
This commit is contained in:
parent
32ba100ee4
commit
280fdeeab0
17 changed files with 229 additions and 82 deletions
10
build.sh
Executable file
10
build.sh
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
set -x
|
||||||
|
|
||||||
|
nix-build \
|
||||||
|
--no-out-link \
|
||||||
|
--pure \
|
||||||
|
"${@}"
|
||||||
|
|
||||||
|
exit 0
|
|
@ -13,14 +13,9 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
system.autoUpgrade = {
|
nixpkgs.config = import ./nix-store/config.nix;
|
||||||
allowReboot = false;
|
|
||||||
enable = true;
|
|
||||||
dates = "hourly";
|
|
||||||
};
|
|
||||||
|
|
||||||
home-manager.users.charlotte = { ... }: {
|
home-manager.users.charlotte = { ... }: {
|
||||||
nixpkgs.config = import ./nix-store/config.nix;
|
|
||||||
xdg.configFile."nixpkgs/config.nix".source = ./nix-store/config.nix;
|
xdg.configFile."nixpkgs/config.nix".source = ./nix-store/config.nix;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
7
imports/home-manager/default.nix
Normal file
7
imports/home-manager/default.nix
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
let
|
||||||
|
metadata = import ./metadata.nix;
|
||||||
|
in
|
||||||
|
builtins.fetchTarball {
|
||||||
|
url = "https://github.com/rycee/home-manager/archive/${metadata.rev}.tar.gz";
|
||||||
|
sha256 = metadata.sha256;
|
||||||
|
}
|
9
imports/home-manager/metadata.nix
Normal file
9
imports/home-manager/metadata.nix
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
url = "https://github.com/rycee/home-manager/archive/master.tar.gz";
|
||||||
|
repo_git = "https://github.com/rycee/home-manager";
|
||||||
|
branch = "master";
|
||||||
|
rev = "5f189acce44dc39ea4055bfd8064adaf90d7fb5a";
|
||||||
|
sha256 = "0ibmvg3k9m9yzh8ln3jlh47nrvgg81iy8gpl112wjimlp6gagxw6";
|
||||||
|
revdate = "2020-07-04 12:21:02 +0200";
|
||||||
|
skip = false;
|
||||||
|
}
|
7
imports/nixpkgs/default.nix
Normal file
7
imports/nixpkgs/default.nix
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
let
|
||||||
|
metadata = import ./metadata.nix;
|
||||||
|
in
|
||||||
|
builtins.fetchTarball {
|
||||||
|
url = "https://github.com/charvp/nixpkgs/archive/${metadata.rev}.tar.gz";
|
||||||
|
sha256 = metadata.sha256;
|
||||||
|
}
|
9
imports/nixpkgs/metadata.nix
Normal file
9
imports/nixpkgs/metadata.nix
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
url = "https://github.com/charvp/nixpkgs/archive/master.tar.gz";
|
||||||
|
repo_git = "https://github.com/charvp/nixpkgs";
|
||||||
|
branch = "master";
|
||||||
|
rev = "c3bce2b5aa52fdfe607bcd74031cc80678a379c1";
|
||||||
|
sha256 = "16fhd1cklc5ygp35a6jy2v5xjvzrb892mqjabf1hj125hfx3zymn";
|
||||||
|
revdate = "2020-07-08 09:11:37 +0200";
|
||||||
|
skip = false;
|
||||||
|
}
|
33
lib.nix
Normal file
33
lib.nix
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
findImport = name:
|
||||||
|
let
|
||||||
|
localpath = ./.. + "/${name}";
|
||||||
|
importpath = ./imports + "/${name}";
|
||||||
|
in
|
||||||
|
if builtins.pathExists localpath then
|
||||||
|
localpath
|
||||||
|
else if builtins.pathExists importpath then
|
||||||
|
(import importpath)
|
||||||
|
else (abort "couldn't find import ${name}");
|
||||||
|
|
||||||
|
mkSystem = { nixpkgs, system ? "x86_64-linux", rev ? "git", extraModules ? [ ], ... }:
|
||||||
|
let
|
||||||
|
pkgs = import (nixpkgs) {
|
||||||
|
inherit (machine.config.nixpkgs) config overlays;
|
||||||
|
};
|
||||||
|
nixPath = pkgs.runCommand "nix-path"
|
||||||
|
{ } ''
|
||||||
|
mkdir -p $out
|
||||||
|
ln -s "${nixpkgs}" $out/nixpkgs
|
||||||
|
'';
|
||||||
|
machine = import "${nixpkgs}/nixos/lib/eval-config.nix" {
|
||||||
|
inherit system;
|
||||||
|
modules = [
|
||||||
|
({ ... }: {
|
||||||
|
nix.nixPath = [ "${nixPath}" ];
|
||||||
|
})
|
||||||
|
] ++ extraModules;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
machine;
|
||||||
|
}
|
40
machines/kholinar/configuration.nix
Normal file
40
machines/kholinar/configuration.nix
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
{ pkgs, lib, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./hardware.nix
|
||||||
|
./secret.nix
|
||||||
|
../../configurations/eid.nix
|
||||||
|
../../profiles/bluetooth.nix
|
||||||
|
../../profiles/common.nix
|
||||||
|
../../profiles/graphical.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
hostId = "3cc1a4b2";
|
||||||
|
hostName = "kholinar";
|
||||||
|
};
|
||||||
|
|
||||||
|
time.timeZone = "Europe/Brussels";
|
||||||
|
|
||||||
|
# This value determines the NixOS release from which the default
|
||||||
|
# settings for stateful data, like file locations and database versions
|
||||||
|
# on your system were taken. It‘s perfectly fine and recommended to leave
|
||||||
|
# this value at the release version of the first install of this system.
|
||||||
|
# Before changing this value read the documentation for this option
|
||||||
|
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||||
|
system.stateVersion = "20.09";
|
||||||
|
|
||||||
|
home-manager.users.charlotte = { ... }: {
|
||||||
|
home.stateVersion = "20.09";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Machine-specific settings
|
||||||
|
custom = {
|
||||||
|
git.email = "charlotte@vanpetegem.me";
|
||||||
|
zfs = {
|
||||||
|
enable = true;
|
||||||
|
encrypted = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,40 +1,9 @@
|
||||||
{ pkgs, lib, ... }:
|
let
|
||||||
|
lib = import ../../lib.nix;
|
||||||
{
|
system = lib.mkSystem {
|
||||||
imports = [
|
nixpkgs = (lib.findImport "nixpkgs");
|
||||||
./hardware.nix
|
extraModules = [ ./configuration.nix ];
|
||||||
./secret.nix
|
system = "x86_64-linux";
|
||||||
../../configurations/eid.nix
|
|
||||||
../../profiles/bluetooth.nix
|
|
||||||
../../profiles/common.nix
|
|
||||||
../../profiles/graphical.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
networking = {
|
|
||||||
hostId = "3cc1a4b2";
|
|
||||||
hostName = "kholinar";
|
|
||||||
};
|
};
|
||||||
|
in
|
||||||
time.timeZone = "Europe/Brussels";
|
system.config.system.build.toplevel
|
||||||
|
|
||||||
# This value determines the NixOS release from which the default
|
|
||||||
# settings for stateful data, like file locations and database versions
|
|
||||||
# on your system were taken. It‘s perfectly fine and recommended to leave
|
|
||||||
# this value at the release version of the first install of this system.
|
|
||||||
# Before changing this value read the documentation for this option
|
|
||||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
|
||||||
system.stateVersion = "20.09";
|
|
||||||
|
|
||||||
home-manager.users.charlotte = { ... }: {
|
|
||||||
home.stateVersion = "20.09";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Machine-specific settings
|
|
||||||
custom = {
|
|
||||||
git.email = "charlotte@vanpetegem.me";
|
|
||||||
zfs = {
|
|
||||||
enable = true;
|
|
||||||
encrypted = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
33
machines/oldtown/configuration.nix
Normal file
33
machines/oldtown/configuration.nix
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./hardware.nix
|
||||||
|
./secret.nix
|
||||||
|
../../configurations/eid.nix
|
||||||
|
../../profiles/bluetooth.nix
|
||||||
|
../../profiles/common.nix
|
||||||
|
../../profiles/graphical.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
networking.hostName = "oldtown";
|
||||||
|
|
||||||
|
time.timeZone = "Europe/Brussels";
|
||||||
|
|
||||||
|
# This value determines the NixOS release from which the default
|
||||||
|
# settings for stateful data, like file locations and database versions
|
||||||
|
# on your system were taken. It‘s perfectly fine and recommended to leave
|
||||||
|
# this value at the release version of the first install of this system.
|
||||||
|
# Before changing this value read the documentation for this option
|
||||||
|
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||||
|
system.stateVersion = "20.03";
|
||||||
|
|
||||||
|
home-manager.users.charlotte = { ... }: {
|
||||||
|
home.stateVersion = "20.03";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Machine-specific application settings
|
||||||
|
custom = {
|
||||||
|
git.email = "charlotte.vanpetegem@ugent.be";
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,33 +1,9 @@
|
||||||
{ config, pkgs, ... }:
|
let
|
||||||
|
lib = import ../../lib.nix;
|
||||||
{
|
system = lib.mkSystem {
|
||||||
imports = [
|
nixpkgs = (lib.findImport "nixpkgs");
|
||||||
./hardware.nix
|
extraModules = [ ./configuration.nix ];
|
||||||
./secret.nix
|
system = "x86_64-linux";
|
||||||
../../configurations/eid.nix
|
|
||||||
../../profiles/bluetooth.nix
|
|
||||||
../../profiles/common.nix
|
|
||||||
../../profiles/graphical.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
networking.hostName = "oldtown";
|
|
||||||
|
|
||||||
time.timeZone = "Europe/Brussels";
|
|
||||||
|
|
||||||
# This value determines the NixOS release from which the default
|
|
||||||
# settings for stateful data, like file locations and database versions
|
|
||||||
# on your system were taken. It‘s perfectly fine and recommended to leave
|
|
||||||
# this value at the release version of the first install of this system.
|
|
||||||
# Before changing this value read the documentation for this option
|
|
||||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
|
||||||
system.stateVersion = "20.03";
|
|
||||||
|
|
||||||
home-manager.users.charlotte = { ... }: {
|
|
||||||
home.stateVersion = "20.03";
|
|
||||||
};
|
};
|
||||||
|
in
|
||||||
# Machine-specific application settings
|
system.config.system.build.toplevel
|
||||||
custom = {
|
|
||||||
git.email = "charlotte.vanpetegem@ugent.be";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix> ];
|
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
loader = {
|
loader = {
|
||||||
|
|
|
@ -14,6 +14,5 @@ in
|
||||||
|
|
||||||
home-manager.users.charlotte = { pkgs, lib, ... }: {
|
home-manager.users.charlotte = { pkgs, lib, ... }: {
|
||||||
xdg.configFile = lib.attrsets.mapAttrs' (name: value: { name = "nixpkgs/overlays/${name}"; value = { source = value; }; }) set;
|
xdg.configFile = lib.attrsets.mapAttrs' (name: value: { name = "nixpkgs/overlays/${name}"; value = { source = value; }; }) set;
|
||||||
nixpkgs.overlays = overlays;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
|
let
|
||||||
|
findImport = (import ../lib.nix).findImport;
|
||||||
|
home-manager = findImport "home-manager";
|
||||||
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
<home-manager/nixos>
|
"${home-manager}/nixos"
|
||||||
../modules/zfs.nix
|
../modules/zfs.nix
|
||||||
../overlays/default.nix
|
../overlays/default.nix
|
||||||
../configurations/direnv.nix
|
../configurations/direnv.nix
|
||||||
|
@ -18,6 +21,7 @@
|
||||||
../configurations/zsh.nix
|
../configurations/zsh.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
home-manager.users.charlotte = { pkgs, ... }: {
|
home-manager.users.charlotte = { pkgs, ... }: {
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
hledger
|
hledger
|
||||||
|
|
|
@ -3,6 +3,7 @@ let
|
||||||
in
|
in
|
||||||
pkgs.mkShell {
|
pkgs.mkShell {
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
|
jq
|
||||||
nixpkgs-fmt
|
nixpkgs-fmt
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
46
update-imports.sh
Executable file
46
update-imports.sh
Executable file
|
@ -0,0 +1,46 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
set -x
|
||||||
|
|
||||||
|
export NIX_PATH="nixpkgs=https://github.com/nixos/nixpkgs/archive/nixos-unstable.tar.gz"
|
||||||
|
|
||||||
|
function update() {
|
||||||
|
pkg="${1}"
|
||||||
|
|
||||||
|
metadata="${pkg}/metadata.nix"
|
||||||
|
pkgname="$(basename "${pkg}")"
|
||||||
|
|
||||||
|
branch="$(nix-instantiate "${metadata}" --eval --json -A branch | jq -r .)"
|
||||||
|
rev="$(nix-instantiate "${metadata}" --eval --json -A rev | jq -r .)"
|
||||||
|
date="$(nix-instantiate "${metadata}" --eval --json -A revdate | jq -r .)"
|
||||||
|
sha256="$(nix-instantiate "${metadata}" --eval --json -A sha256 | jq -r .)"
|
||||||
|
url="$(nix-instantiate "${metadata}" --eval --json -A url | jq -r .)"
|
||||||
|
skip="$(nix-instantiate "${metadata}" --eval --json -A skip || echo "false" | jq -r .)"
|
||||||
|
|
||||||
|
newdate="${date}"
|
||||||
|
if [[ "${skip}" != "true" ]]; then
|
||||||
|
repo="$(nix-instantiate "${metadata}" --eval --json -A repo_git | jq -r .)"
|
||||||
|
newrev="$(git ls-remote "${repo}" "${branch}" | awk '{ print $1}')"
|
||||||
|
|
||||||
|
if [[ "${rev}" != "${newrev}" ]]; then
|
||||||
|
# Update RevDate
|
||||||
|
d="$(mktemp -d)"
|
||||||
|
git clone -b "${branch}" --single-branch --depth=1 "${repo}" "${d}"
|
||||||
|
newdate="$(cd "${d}"; git log --format=%ci --max-count=1)"
|
||||||
|
rm -rf "${d}"
|
||||||
|
|
||||||
|
# Update Sha256
|
||||||
|
newsha256="$(nix-prefetch-url --unpack "${url}")"
|
||||||
|
|
||||||
|
# TODO: do this with nix instead of sed?
|
||||||
|
sed -i "s/${rev}/${newrev}/" "${metadata}"
|
||||||
|
sed -i "s/${date}/${newdate}/" "${metadata}"
|
||||||
|
sed -i "s/${sha256}/${newsha256}/" "${metadata}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
for p in imports/*; do
|
||||||
|
update "${p}"
|
||||||
|
done
|
9
update.sh
Executable file
9
update.sh
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
set -x
|
||||||
|
|
||||||
|
./update-imports.sh
|
||||||
|
|
||||||
|
result="$(./build.sh "./machines/$(hostname)")"
|
||||||
|
|
||||||
|
sudo bash -c "nix-env --set --profile /nix/var/nix/profiles/system/ ${result} && ${result}/bin/switch-to-configuration switch"
|
Loading…
Add table
Add a link
Reference in a new issue