Compare commits
No commits in common. "597b50ebef69fabccdd0e9e4252efeecfa7e5c59" and "e013bcfdba0b7325d6502fda28fbcd8d28d56623" have entirely different histories.
597b50ebef
...
e013bcfdba
8
add_channels.sh
Executable file
8
add_channels.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# TODO Flakes
|
||||
|
||||
nix-channel --add https://nixos.org/channels/nixos-23.11 nixpkgs
|
||||
nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz home-manager
|
||||
nix-channel --add https://github.com/NixOS/nixos-hardware/archive/8772491ed75f150f02552c60694e1beff9f46013.tar.gz nixos-hardware
|
||||
nix-channel --update
|
|
@ -2,9 +2,6 @@
|
|||
#! nix-shell -i bash
|
||||
#! nix-shell -p bash nix-output-monitor
|
||||
|
||||
echo FIXME Not flakes ready
|
||||
exit 1
|
||||
|
||||
set -euo pipefail
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
#! nix-shell -i bash
|
||||
#! nix-shell -p bash nix-output-monitor
|
||||
|
||||
echo FIXME Not flakes ready
|
||||
exit 1
|
||||
|
||||
set -euo pipefail
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ in
|
|||
type = "luks";
|
||||
name = "boot";
|
||||
extraFormatArgs = [ "--type luks1" ];
|
||||
passwordFile = passwordFile;
|
||||
passwordFile = "FIXME";
|
||||
settings = {
|
||||
# keyFile = "/etc/keys/boot";
|
||||
};
|
||||
|
@ -94,7 +94,7 @@ in
|
|||
content = {
|
||||
type = "luks";
|
||||
name = "razmo";
|
||||
passwordFile = passwordFile;
|
||||
passwordFile = "FIXME";
|
||||
settings = {
|
||||
# keyFile = "/etc/keys/razmo";
|
||||
};
|
||||
|
@ -129,7 +129,7 @@ in
|
|||
content = {
|
||||
type = "luks";
|
||||
name = "rapswap";
|
||||
passwordFile = passwordFile;
|
||||
passwordFile = "FIXME";
|
||||
settings = {
|
||||
# keyFile = "/etc/keys/rapswap";
|
||||
allowDiscards = true;
|
||||
|
@ -147,7 +147,7 @@ in
|
|||
type = "luks";
|
||||
name = "rapido";
|
||||
initrdUnlock = true;
|
||||
passwordFile = passwordFile;
|
||||
passwordFile = "FIXME";
|
||||
settings = {
|
||||
# keyFile = "/etc/keys/rapido";
|
||||
allowDiscards = true;
|
||||
|
|
|
@ -348,11 +348,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1704420045,
|
||||
"narHash": "sha256-C36QmoJd5tdQ5R9MC1jM7fBkZW9zBUqbUCsgwS6j4QU=",
|
||||
"lastModified": 1704295289,
|
||||
"narHash": "sha256-9WZDRfpMqCYL6g/HNWVvXF0hxdaAgwgIGeLYiOhmes8=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c1be43e8e837b8dbee2b3665a007e761680f0c3d",
|
||||
"rev": "b0b2c5445c64191fd8d0b31f2b1a34e45a64547d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -22,10 +22,7 @@ in
|
|||
nixpkgs.config.allowUnfree = true;
|
||||
nix = {
|
||||
package = lib.mkDefault pkgs.nixFlakes;
|
||||
settings = {
|
||||
experimental-features = [ "nix-command" "flakes" ];
|
||||
warn-dirty = false;
|
||||
};
|
||||
settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
};
|
||||
|
||||
programs =
|
||||
|
@ -456,7 +453,6 @@ in
|
|||
ncdu
|
||||
jdupes
|
||||
duperemove
|
||||
compsize
|
||||
|
||||
# local monitoring
|
||||
htop
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
./dev.nix
|
||||
./extra.nix
|
||||
./gaming
|
||||
./rebuild
|
||||
./ssh.nix
|
||||
./style.nix
|
||||
./usernix
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
{ pkgs, config, ... }:
|
||||
let
|
||||
ulf = pkgs.writers.writePython3 "update-local-flakes" {
|
||||
} (builtins.readFile ./update-local-flakes.py);
|
||||
in
|
||||
{
|
||||
home.packages = [
|
||||
(pkgs.writeShellApplication {
|
||||
name = "rb";
|
||||
runtimeInputs = [ pkgs.brightnessctl ];
|
||||
text = ''
|
||||
verb="switch"
|
||||
if [ "$#" -ge 1 ]
|
||||
then
|
||||
verb="$1"
|
||||
shift
|
||||
fi
|
||||
nixos_flake="/etc/nixos/flake.nix"
|
||||
if [ -f "$nixos_flake" ]
|
||||
then
|
||||
sudo ${ulf} "$nixos_flake"
|
||||
if [ "$verb" = "switch" ] || [ "$verb" = "test" ]
|
||||
then
|
||||
sudo nixos-rebuild "$verb" --specialisation ${config.frogeye.polarity} "$@"
|
||||
else
|
||||
sudo nixos-rebuild "$verb" "$@"
|
||||
fi
|
||||
fi
|
||||
hm_flake="${config.xdg.configHome}/home-manager/flake.nix"
|
||||
if [ -f "$hm_flake" ]
|
||||
then
|
||||
${ulf} "$hm_flake"
|
||||
home-manager "$verb" "$@"
|
||||
fi
|
||||
'';
|
||||
})
|
||||
];
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
import argparse
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
GET_INPUTS_CMD = [
|
||||
"nix-instantiate",
|
||||
"--eval",
|
||||
"--json", # This parser is stupid, better provide it with pre-eaten stuff
|
||||
"--expr",
|
||||
"builtins.fromJSON (builtins.toJSON (import ./flake.nix).inputs)",
|
||||
]
|
||||
|
||||
|
||||
def process_flake(flake: str) -> None:
|
||||
# get full path
|
||||
if not os.path.isfile(flake):
|
||||
raise FileNotFoundError(f"Flake not found: {flake}")
|
||||
dir = os.path.dirname(flake)
|
||||
# import dependencies
|
||||
p = subprocess.run(GET_INPUTS_CMD, cwd=dir, stdout=subprocess.PIPE)
|
||||
deps = json.loads(p.stdout)
|
||||
p.check_returncode()
|
||||
# for each dependency
|
||||
for dep_name, dep in deps.items():
|
||||
dep_url = dep["url"]
|
||||
# if not local path, continue
|
||||
if not (
|
||||
dep_url.startswith("path:") or dep_url.startswith("git+file:")
|
||||
):
|
||||
continue
|
||||
if dep.get("flake", True):
|
||||
# get flake file corresponding
|
||||
dep_path = dep_url.split(":")[1]
|
||||
if not dep_path.startswith("/"):
|
||||
dep_path = os.path.join(dir, dep_path)
|
||||
dep_path = os.path.normpath(dep_path)
|
||||
dep_flake = os.path.join(dep_path, "flake.nix")
|
||||
# call this function with the flake file
|
||||
process_flake(dep_flake)
|
||||
# update lockfile
|
||||
cmd = ["nix", "flake", "lock", "--update-input", dep_name]
|
||||
subprocess.run(cmd, cwd=dir)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Recursively update lockfiles "
|
||||
"of flakes located on the system"
|
||||
)
|
||||
parser.add_argument("flake", help="Starting flake", default="flake.nix")
|
||||
args = parser.parse_args()
|
||||
process_flake(args.flake)
|
19
hm/style.nix
19
hm/style.nix
|
@ -1,6 +1,9 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
let
|
||||
# Currently last commit in https://github.com/danth/stylix/pull/194
|
||||
polarityFile = "${config.xdg.stateHome}/theme_polarity";
|
||||
polarityFromFile = if builtins.pathExists polarityFile then lib.strings.fileContents polarityFile else "light";
|
||||
polarity = if config.frogeye.polarity == "dynamic" then polarityFromFile else config.frogeye.polarity;
|
||||
phases = [
|
||||
{ command = "jour"; polarity = "light"; }
|
||||
{ command = "crepuscule"; polarity = "dark"; }
|
||||
|
@ -11,7 +14,7 @@ in
|
|||
{
|
||||
stylix = {
|
||||
|
||||
base16Scheme = "${pkgs.base16-schemes}/share/themes/solarized-${config.frogeye.polarity}.yaml";
|
||||
base16Scheme = "${pkgs.base16-schemes}/share/themes/solarized-${polarity}.yaml";
|
||||
image = builtins.fetchurl {
|
||||
url = "https://get.wallhere.com/photo/sunlight-abstract-minimalism-green-simple-circle-light-leaf-wave-material-line-wing-computer-wallpaper-font-close-up-macro-photography-124350.png";
|
||||
sha256 = "sha256:1zfq3f3v34i45mi72pkfqphm8kbhczsg260xjfl6dbydy91d7y93";
|
||||
|
@ -33,6 +36,10 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
# Setting a custom base16 theme via nixvim:
|
||||
# - Is required so nixvim works
|
||||
# - For the rest only works on dark polarity, use the colorscheme otherwise... shrug
|
||||
# programs.nixvim.colorschemes.base16.colorscheme = "solarized-${polarity}";
|
||||
|
||||
# Fix https://nix-community.github.io/home-manager/index.html#_why_do_i_get_an_error_message_about_literal_ca_desrt_dconf_literal_or_literal_dconf_service_literal
|
||||
# home.packages = [ pkgs.dconf ];
|
||||
|
@ -46,12 +53,14 @@ in
|
|||
text = (lib.optionalString cfg.enable ''
|
||||
brightnessctl set ${builtins.getAttr phase.command cfg}
|
||||
'') + ''
|
||||
switch="/nix/var/nix/profiles/system/specialisation/${phase.polarity}/bin/switch-to-configuration"
|
||||
if [ -x "$switch" ]
|
||||
echo ${phase.polarity} > ${polarityFile}
|
||||
if command -v home-manager
|
||||
then
|
||||
home-manager switch
|
||||
else
|
||||
# In two steps to get the visual changes slightly earlier
|
||||
sudo "$switch" test
|
||||
sudo "$switch" boot
|
||||
sudo /nix/var/nix/profiles/system/specialisation/${phase.polarity}/bin/switch-to-configuration test
|
||||
sudo /nix/var/nix/profiles/system/specialisation/${phase.polarity}/bin/switch-to-configuration boot
|
||||
fi
|
||||
'';
|
||||
})
|
||||
|
|
|
@ -27,10 +27,6 @@ in
|
|||
|
||||
programs.nixvim = {
|
||||
enable = true;
|
||||
# Setting a custom base16 theme via nixvim is required so feline works, and
|
||||
# because stylix makes a config that otherwise only works with dark
|
||||
# polarity.
|
||||
colorschemes.base16.colorscheme = "solarized-${config.frogeye.polarity}";
|
||||
options = {
|
||||
# From https://www.hillelwayne.com/post/intermediate-vim/
|
||||
title = true;
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
#! nix-shell -i bash
|
||||
#! nix-shell -p bash nixos-install-tools
|
||||
|
||||
echo FIXME Not flakes ready
|
||||
exit 1
|
||||
|
||||
set -euo pipefail
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
|
@ -94,19 +91,6 @@ sudo nixos-generate-config --no-filesystems --root "$mountpoint"
|
|||
# Plug system configuration into this git repo
|
||||
sudo mkdir -p "${mountpoint}/etc/nixos"
|
||||
echo "{ ... }: { imports = [ ./hardware-configuration.nix ${nixos_config} ]; }" | sudo tee "${mountpoint}/etc/nixos/configuration.nix" > /dev/null
|
||||
# EXAMPLE
|
||||
# {
|
||||
# description = "curacao system config";
|
||||
#
|
||||
# inputs.dotfiles.url = "git+file:/home/geoffrey/.config/gdotfiles";
|
||||
#
|
||||
# outputs = { self, dotfiles, ... }:
|
||||
# {
|
||||
# nixosConfigurations.curacao = dotfiles.nixosConfigurations.curacao.extendModules {
|
||||
# modules = [ ./hardware-configuration.nix ];
|
||||
# };
|
||||
# };
|
||||
# }
|
||||
# Everything there should be covered by (and conflicts with) the repo anyways.
|
||||
|
||||
# Install NixOS! Or create a new generation.
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
gaming = lib.mkEnableOption "Games";
|
||||
userNix = lib.mkEnableOption "Nix is \"installed\" in ~/.nix";
|
||||
polarity = lib.mkOption {
|
||||
default = "light";
|
||||
default = "dynamic";
|
||||
description = "Whether to use light theme or dark theme.";
|
||||
type = lib.types.enum [ "light" "dark" ];
|
||||
type = lib.types.enum [ "dynamic" "light" "dark" ];
|
||||
};
|
||||
desktop = {
|
||||
xorg = lib.mkEnableOption "Enable X11 support";
|
||||
|
|
|
@ -29,10 +29,7 @@
|
|||
];
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
nix.settings = {
|
||||
experimental-features = [ "nix-command" "flakes" ];
|
||||
warn-dirty = false;
|
||||
};
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
programs = {
|
||||
adb.enable = true;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
./desktop.nix
|
||||
./gaming
|
||||
./geoffrey.nix
|
||||
./wireless.nix
|
||||
# ./wireless.nix
|
||||
# FIXME networks.json is git-ignored, so flakes will not use it
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
{
|
||||
config = lib.mkIf config.frogeye.gaming
|
||||
{
|
||||
config = lib.mkIf config.frogeye.gaming {
|
||||
programs.steam.enable = true;
|
||||
hardware.opengl.driSupport32Bit = true; # Enables support for 32bit libs that steam uses
|
||||
};
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
# wireless support via wpa_supplicant
|
||||
networking.wireless = {
|
||||
enable = true;
|
||||
networks = builtins.fromJSON (builtins.readFile ./wireless/networks.json); # If this file doesn't exist, run ./wireless/import.py
|
||||
extraConfig = ''
|
||||
country=NL
|
||||
'';
|
||||
|
|
4
os/wireless/.gitignore
vendored
4
os/wireless/.gitignore
vendored
|
@ -1,2 +1,2 @@
|
|||
wireless_networks.json
|
||||
wireless_networks.env
|
||||
networks.json
|
||||
networks.env
|
||||
|
|
|
@ -11,7 +11,6 @@ Exports Wi-Fi networks configuration stored in pass into a format readable by Ni
|
|||
# url = "https://letsencrypt.org/certs/isrgrootx1.pem";
|
||||
# sha256 = "sha256:1la36n2f31j9s03v847ig6ny9lr875q3g7smnq33dcsmf2i5gd92";
|
||||
# }
|
||||
# TODO Very ugly, can probably do better
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
|
@ -158,14 +157,10 @@ for path in list_networks():
|
|||
for suffix in suffixes:
|
||||
networks[ssid + suffix] = network
|
||||
|
||||
with open("wireless_networks.json", "w") as fd:
|
||||
with open("networks.json", "w") as fd:
|
||||
json.dump(networks, fd, indent=4)
|
||||
|
||||
with open("wireless_networks.env", "w") as fd:
|
||||
with open("networks.env", "w") as fd:
|
||||
if SEPARATE_PASSWORDS:
|
||||
for k, v in Password.vars().items():
|
||||
print(f"{k}={v}", file=fd)
|
||||
|
||||
print("Now, execute:")
|
||||
print("sudo mv -f wireless_networks.* /etc/keys")
|
||||
print("sudo nixos-rebuild switch")
|
||||
|
|
Loading…
Reference in a new issue