Flakes, but it doesn't work 😞
This commit is contained in:
parent
50cb3fabb7
commit
c59fd9a5a7
16 changed files with 206 additions and 220 deletions
|
@ -5,21 +5,22 @@
|
||||||
{ path = ".local/share/direnv"; type = "cache"; }
|
{ path = ".local/share/direnv"; type = "cache"; }
|
||||||
];
|
];
|
||||||
|
|
||||||
nix.extraOptions = ''
|
|
||||||
keep-outputs = true
|
|
||||||
keep-derivations = true
|
|
||||||
'';
|
|
||||||
|
|
||||||
home-manager.users.charlotte = { ... }: {
|
home-manager.users.charlotte = { ... }: {
|
||||||
programs.direnv = {
|
programs.direnv = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableNixDirenvIntegration = true;
|
|
||||||
enableZshIntegration = true;
|
enableZshIntegration = true;
|
||||||
config = {
|
config = {
|
||||||
global = {
|
global = {
|
||||||
strict_env = true;
|
strict_env = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
stdlib = ''
|
||||||
|
use_flake() {
|
||||||
|
watch_file flake.nix
|
||||||
|
watch_file flake.lock
|
||||||
|
eval "$(nix --experimental-features 'nix-commnand flakes' print-dev-env --profile "$(direnv_layout_dir)/flake-profile")"
|
||||||
|
}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
{ ... }:
|
{ pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
nix = {
|
nix = {
|
||||||
|
extraOptions = ''
|
||||||
|
experimental-features = nix-command flakes
|
||||||
|
'';
|
||||||
|
package = pkgs.nixFlakes;
|
||||||
gc = {
|
gc = {
|
||||||
automatic = true;
|
automatic = true;
|
||||||
dates = "hourly";
|
dates = "hourly";
|
||||||
|
|
67
flake.lock
generated
Normal file
67
flake.lock
generated
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1595332686,
|
||||||
|
"narHash": "sha256-GpzwLOx6fvtsAnjPqG0ob5GXR0e4eWThwgWedo3qeNc=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "f99f5970824e210e84f9a766e2ea52d4af770182",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"ref": "master",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"home-manager": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1594886249,
|
||||||
|
"narHash": "sha256-Z2REbQYsYBrdWc6Dz9MmtSReaanIMoJmmnUXNeQHaJY=",
|
||||||
|
"owner": "ehmry",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"rev": "24f437c263207e22147f50e59c879078a58b17ba",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "ehmry",
|
||||||
|
"ref": "flake",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1595363904,
|
||||||
|
"narHash": "sha256-p53BaxRE1FPqdOqVtj3e8dtygME6JzNtJPXYFGb9EPQ=",
|
||||||
|
"ref": "master",
|
||||||
|
"rev": "4da6ffdfb1ee6aaf93c379507dab543091a5536c",
|
||||||
|
"revCount": 235509,
|
||||||
|
"type": "git",
|
||||||
|
"url": "file:///data/home/charlotte/repos/nixpkgs"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "charvp",
|
||||||
|
"ref": "master",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"home-manager": "home-manager",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
45
flake.nix
Normal file
45
flake.nix
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
description = "Nixos configuration flake";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs = { url = "github:charvp/nixpkgs/master"; };
|
||||||
|
home-manager = {
|
||||||
|
url = "github:ehmry/home-manager/flake";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
flake-utils = { url = "github:numtide/flake-utils/master"; };
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, home-manager, flake-utils }:
|
||||||
|
let
|
||||||
|
pkgsFor = system: import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
config = { allowUnfree = true; };
|
||||||
|
};
|
||||||
|
mkSystem = system: hostname: nixpkgs.lib.nixosSystem {
|
||||||
|
inherit system;
|
||||||
|
modules = [
|
||||||
|
home-manager.nixosModules.home-manager
|
||||||
|
(./. + "/machines/${hostname}")
|
||||||
|
];
|
||||||
|
};
|
||||||
|
in
|
||||||
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
|
let
|
||||||
|
pkgs = pkgsFor system;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
devShell = pkgs.mkShell {
|
||||||
|
buildInputs = with nixpkgs.legacyPackages.${system}; [
|
||||||
|
jq
|
||||||
|
nixUnstable
|
||||||
|
nixpkgs-fmt
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}) // {
|
||||||
|
nixosConfigurations = {
|
||||||
|
kharbranth = mkSystem "x86_64-linux" "kharbranth";
|
||||||
|
kholinar = mkSystem "x86_64-linux" "kholinar";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,7 +0,0 @@
|
||||||
let
|
|
||||||
metadata = import ./metadata.nix;
|
|
||||||
in
|
|
||||||
builtins.fetchTarball {
|
|
||||||
url = "https://github.com/rycee/home-manager/archive/${metadata.rev}.tar.gz";
|
|
||||||
sha256 = metadata.sha256;
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
url = "https://github.com/rycee/home-manager/archive/master.tar.gz";
|
|
||||||
repo_git = "https://github.com/rycee/home-manager";
|
|
||||||
branch = "master";
|
|
||||||
rev = "8ad55800216760291e253150a7ecc831c2956229";
|
|
||||||
sha256 = "0nif0a2pv5wgyjhfqd8jmlc055y0604xmqfnnr2hfrzz0blpl4ww";
|
|
||||||
revdate = "2020-07-21 01:10:54 +0200";
|
|
||||||
skip = false;
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
let
|
|
||||||
metadata = import ./metadata.nix;
|
|
||||||
in
|
|
||||||
builtins.fetchTarball {
|
|
||||||
url = "https://github.com/charvp/nixpkgs/archive/${metadata.rev}.tar.gz";
|
|
||||||
sha256 = metadata.sha256;
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
url = "https://github.com/charvp/nixpkgs/archive/master.tar.gz";
|
|
||||||
repo_git = "https://github.com/charvp/nixpkgs";
|
|
||||||
branch = "master";
|
|
||||||
rev = "1cab31c02385445cd86b2930201f02708fe504d9";
|
|
||||||
sha256 = "1c2wm4wyrswi61bfrb7yyv2025xg31shs7h1l0662vkjmd58vjaf";
|
|
||||||
revdate = "2020-07-21 09:11:54 +0200";
|
|
||||||
skip = false;
|
|
||||||
}
|
|
25
lib.nix
25
lib.nix
|
@ -1,25 +0,0 @@
|
||||||
{
|
|
||||||
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
|
|
||||||
machine = import "${nixpkgs}/nixos/lib/eval-config.nix" {
|
|
||||||
inherit system;
|
|
||||||
modules = [
|
|
||||||
({ ... }: {
|
|
||||||
nix.nixPath = [ "nixpkgs=${nixpkgs}" ];
|
|
||||||
})
|
|
||||||
] ++ extraModules;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
machine;
|
|
||||||
}
|
|
|
@ -1,40 +0,0 @@
|
||||||
{ config, pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
./hardware.nix
|
|
||||||
./secret.nix
|
|
||||||
../../configurations/eid.nix
|
|
||||||
../../profiles/bluetooth.nix
|
|
||||||
../../profiles/common.nix
|
|
||||||
../../profiles/graphical.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
networking = {
|
|
||||||
hostId = "e718389d";
|
|
||||||
hostName = "kharbranth";
|
|
||||||
};
|
|
||||||
|
|
||||||
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 application settings
|
|
||||||
custom = {
|
|
||||||
git.email = "charlotte.vanpetegem@ugent.be";
|
|
||||||
zfs = {
|
|
||||||
enable = true;
|
|
||||||
encrypted = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,9 +1,40 @@
|
||||||
let
|
{ config, pkgs, ... }:
|
||||||
lib = import ../../lib.nix;
|
|
||||||
system = lib.mkSystem {
|
{
|
||||||
nixpkgs = (lib.findImport "nixpkgs");
|
imports = [
|
||||||
extraModules = [ ./configuration.nix ];
|
./hardware.nix
|
||||||
system = "x86_64-linux";
|
./secret.nix
|
||||||
|
../../configurations/eid.nix
|
||||||
|
../../profiles/bluetooth.nix
|
||||||
|
../../profiles/common.nix
|
||||||
|
../../profiles/graphical.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
hostId = "e718389d";
|
||||||
|
hostName = "kharbranth";
|
||||||
};
|
};
|
||||||
in
|
|
||||||
system.config.system.build.toplevel
|
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 application settings
|
||||||
|
custom = {
|
||||||
|
git.email = "charlotte.vanpetegem@ugent.be";
|
||||||
|
zfs = {
|
||||||
|
enable = true;
|
||||||
|
encrypted = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
{ 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,9 +1,40 @@
|
||||||
let
|
{ pkgs, lib, ... }:
|
||||||
lib = import ../../lib.nix;
|
|
||||||
system = lib.mkSystem {
|
{
|
||||||
nixpkgs = (lib.findImport "nixpkgs");
|
imports = [
|
||||||
extraModules = [ ./configuration.nix ];
|
./hardware.nix
|
||||||
system = "x86_64-linux";
|
./secret.nix
|
||||||
|
../../configurations/eid.nix
|
||||||
|
../../profiles/bluetooth.nix
|
||||||
|
../../profiles/common.nix
|
||||||
|
../../profiles/graphical.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
hostId = "3cc1a4b2";
|
||||||
|
hostName = "kholinar";
|
||||||
};
|
};
|
||||||
in
|
|
||||||
system.config.system.build.toplevel
|
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,11 +1,7 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
let
|
|
||||||
findImport = (import ../lib.nix).findImport;
|
|
||||||
home-manager = findImport "home-manager";
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
"${home-manager}/nixos"
|
|
||||||
../modules/zfs.nix
|
../modules/zfs.nix
|
||||||
../configurations/direnv.nix
|
../configurations/direnv.nix
|
||||||
../configurations/git.nix
|
../configurations/git.nix
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
let
|
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
|
||||||
pkgs = import <nixpkgs> { };
|
src = ./.;
|
||||||
in
|
}).shellNix
|
||||||
pkgs.mkShell {
|
|
||||||
buildInputs = with pkgs; [
|
|
||||||
jq
|
|
||||||
nixpkgs-fmt
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
#!/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
|
|
Loading…
Add table
Add a link
Reference in a new issue