Compare commits

...

4 commits

Author SHA1 Message Date
Geoffrey Frogeye 2ae8bf4fd0
Remove texlive 2023-12-09 00:45:33 +01:00
Geoffrey Frogeye f20678d134
Use actual encryption passwords 2023-12-09 00:09:36 +01:00
Geoffrey Frogeye 54ec1fc9ba
Fix adb 2023-12-09 00:08:01 +01:00
Geoffrey Frogeye 8a4875cf5b
Rework how X session is started 2023-12-08 22:44:21 +01:00
9 changed files with 71 additions and 58 deletions

View file

@ -1 +1,2 @@
import ../dk/single_uefi_btrfs.nix { id = "usb-Kingston_DataTraveler_3.0_E0D55EA57414F510489F0F1A-0:0"; name = "curacao_usb"; }
{ ... } @ args:
import ../dk/single_uefi_btrfs.nix (args // { id = "usb-Kingston_DataTraveler_3.0_E0D55EA57414F510489F0F1A-0:0"; name = "curacao_usb"; })

View file

@ -1,4 +1,4 @@
{ id, name, ... }:
{ id, name, passwordFile ? "/should_not_be_needed_in_this_context", ... }:
{
disko.devices = {
disk = {
@ -26,7 +26,7 @@
content = {
type = "luks";
name = "${name}";
passwordFile = "/tmp/secret.key"; # FIXME Generate this somehow
passwordFile = passwordFile;
settings = {
# Not having SSDs die fast is more important than crypto
# nerds that could potentially discover which filesystem I

View file

@ -1,20 +1,35 @@
{ pkgs, config, lib, ... }:
let
nixgl = import
(builtins.fetchGit {
url = "https://github.com/nix-community/nixGL";
rev = "489d6b095ab9d289fe11af0219a9ff00fe87c7c5";
})
{ };
nixGLIntelPrefix = "${nixgl.nixVulkanIntel}/bin/nixVulkanIntel ${nixgl.nixGLIntel}/bin/nixGLIntel ";
wmPrefix = "${lib.optionalString config.frogeye.desktop.nixGLIntel nixGLIntelPrefix}";
in
{
imports = [
./frobar
];
config = lib.mkIf config.frogeye.desktop.xorg {
frogeye.shellAliases = {
noise = ''${pkgs.sox}/bin/play -c 2 -n synth $'' + ''{1}noise'';
beep = ''${pkgs.sox}/bin/play -n synth sine E5 sine A4 remix 1-2 fade 0.5 1.2 0.5 2> /dev/null'';
# n = "$HOME/.config/i3/terminal & disown"; # Not used anymore since alacritty daemon mode doesn't preserve environment variables
x = "startx ${config.xdg.configHome}/xinitrc; logout";
nx = "nvidia-xrun ${config.xdg.configHome}/xinitrc; sudo systemctl start nvidia-xrun-pm; logout";
# Was also thinking of not storing the config in .config and use nix-store instead,
# but maybe it's a bad idea as home-manager switch doesn't replace aliases in running shells
# FIXME Is it still relevant with NixOS?
x = "startx ${config.home.homeDirectory}/${config.xsession.scriptPath}; logout";
# TODO Is it possible to not start nvidia stuff on nixOS?
# nx = "nvidia-xrun ${config.xsession.scriptPath}; sudo systemctl start nvidia-xrun-pm; logout";
};
xsession = {
enable = true;
# Not using config.xdg.configHome because it needs to be $HOME-relative paths and path manipulation is hard
scriptPath = ".config/xsession";
profilePath = ".config/xprofile";
windowManager = {
command = lib.mkForce "${wmPrefix} ${config.xsession.windowManager.i3.package}/bin/i3";
i3 = {
enable = true;
config =
@ -68,7 +83,6 @@
{
modifier = "Mod4";
terminal = "alacritty";
bars = [ ]; # Using frobar
colors = let ignore = "#ff00ff"; in
with config.lib.stylix.colors.withHashtag; lib.mkForce {
focused = { border = base0B; background = base0B; text = base00; indicator = base00; childBorder = base0B; };
@ -310,7 +324,6 @@
];
};
startup = [
{ notification = false; command = "${pkgs.autorandr}/bin/autorandr --change"; }
# Lock screen after 10 minutes
{ notification = false; command = "${pkgs.xautolock}/bin/xautolock -time 10 -locker '${pkgs.xorg.xset}/bin/xset dpms force standby' -killtime 1 -killer ${locker}"; }
{
@ -498,14 +511,9 @@
};
autorandr = {
enable = true;
hooks.postswitch =
let
frobar = (pkgs.callPackage (import ./frobar) { });
in
{
"background" = "${pkgs.feh}/bin/feh --no-fehbg --bg-fill ${config.stylix.image}";
"frobar" = "${pkgs.i3}/bin/i3-msg exec ${frobar}/bin/frobar_launcher";
};
hooks.postswitch = {
background = "${pkgs.feh}/bin/feh --no-fehbg --bg-fill ${config.stylix.image}";
};
};
mpv = {
enable = true;
@ -553,23 +561,6 @@
"pulse/client.conf" = {
text = ''cookie-file = .config/pulse/pulse-cookie'';
};
"xinitrc" =
let
nixgl = import
(builtins.fetchGit {
url = "https://github.com/nix-community/nixGL";
rev = "489d6b095ab9d289fe11af0219a9ff00fe87c7c5";
})
{ };
nixGLIntelPrefix = "${nixgl.nixVulkanIntel}/bin/nixVulkanIntel ${nixgl.nixGLIntel}/bin/nixGLIntel ";
wmPrefix = "${lib.optionalString config.frogeye.desktop.nixGLIntel nixGLIntelPrefix}";
in
{
source = pkgs.writeShellScript "xinitrc" ''
${pkgs.xorg.xrdb}/bin/xrdb ${config.xresources.path}
${wmPrefix}${config.xsession.windowManager.command}
'';
};
"rofimoji.rc" = {
text = ''
skin-tone = neutral
@ -593,7 +584,6 @@
};
services = {
unclutter.enable = true;
# FIXME Not starting on curacao_test
dunst =
{
enable = true;

View file

@ -27,7 +27,9 @@
# documents
visidata
texlive.combined.scheme-full
# texlive.combined.scheme-full
# TODO Convert existing LaTeX documents into using Nix build system
# texlive is big and not that much used, sooo
pdftk
hunspell
hunspellDicts.en_GB-ize

View file

@ -1,4 +1,4 @@
{ pkgs ? import <nixpkgs> { config = { }; overlays = [ ]; } }:
{ pkgs ? import <nixpkgs> { config = { }; overlays = [ ]; }, ... }:
# Tried using pyproject.nix but mpd2 dependency wouldn't resolve,
# is called pyton-mpd2 on PyPi but mpd2 in nixpkgs.
let
@ -6,6 +6,7 @@ let
pname = "frobar";
version = "2.0";
runtimeInputs = with pkgs; [ lemonbar-xft wirelesstools ];
propagatedBuildInputs = with pkgs.python3Packages; [
coloredlogs
notmuch
@ -15,21 +16,33 @@ let
pulsectl
pyinotify
];
makeWrapperArgs = [ "--prefix PATH : ${pkgs.lib.makeBinPath (with pkgs; [ lemonbar-xft wirelesstools ])}" ];
src = ./.;
};
frobar_launcher = pkgs.writeShellApplication
{
name = "frobar_launcher";
runtimeInputs = with pkgs; [ lemonbar-xft wirelesstools ];
text = ''
pidfile=$XDG_RUNTIME_DIR/frobar/$DISPLAY.pid
${pkgs.coreutils}/bin/mkdir -p "$(${pkgs.coreutils}/bin/dirname "$pidfile")"
([ -f "$pidfile" ] && ${pkgs.procps}/bin/kill "$(<"$pidfile")") || true
${frobar}/bin/frobar & disown
echo $! > "$pidfile"
'';
};
in
frobar_launcher
# TODO Connection with i3 is lost sometimes, more often than with Arch?
{
config = {
xsession.windowManager.i3.config.bars = [ ];
programs.autorandr.hooks.postswitch = {
frobar = "${pkgs.systemd}/bin/systemctl --user restart frobar";
};
systemd.user.services.frobar = {
Unit = {
Description = "frobar";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
# Wait for i3 to start. Can't use ExecStartPre because otherwise it blocks graphical-session.target, and there's nothing i3/systemd
# TODO Do that better
ExecStart = ''${pkgs.bash}/bin/bash -c "while ! ${pkgs.i3}/bin/i3-msg; do ${pkgs.coreutils}/bin/sleep 1; done; ${frobar}/bin/frobar"'';
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
}
# TODO Connection with i3 is lost on start sometimes, more often than with Arch?
# TODO Restore ability to build frobar with nix-build

View file

@ -64,6 +64,7 @@ fi
mountpoint="/mnt/nixos"
nix_flakes_cmd="nix --extra-experimental-features nix-command --extra-experimental-features flakes"
luks_pass_path="luks/$(basename ${profile})"
set -x
@ -73,8 +74,15 @@ sudo mkdir -p "$mountpoint"
# Not great, but fixable with flakes I guess
sudo ./add_channels.sh
# Load encryption password
luks_pass_file="$(mktemp --suffix="luks_password")"
pass $luks_pass_path | head -n1 | tr -d '\n' > $luks_pass_file
# Format or mount disk
sudo $nix_flakes_cmd run github:nix-community/disko -- --root-mountpoint "$mountpoint" --mode "$disko_mode" "$disko_config"
sudo $nix_flakes_cmd run github:nix-community/disko -- --root-mountpoint "$mountpoint" --mode "$disko_mode" --argstr passwordFile "$luks_pass_file" "$disko_config"
# Unload encryption password
rm "$luks_pass_file"
# Generate hardware-config.nix
sudo nixos-generate-config --no-filesystems --root "$mountpoint"

View file

@ -27,9 +27,6 @@
kexec-tools
openvpn
# android tools
android-udev-rules
# Needed for all the fetchFromGit in this repo on nixos-rebuild
git
];
@ -37,6 +34,7 @@
nixpkgs.config.allowUnfree = true;
programs = {
adb.enable = true;
# Enable compilation cache
ccache.enable = true;
# TODO Not enough, see https://nixos.wiki/wiki/CCache.

View file

@ -6,7 +6,7 @@
users.users.geoffrey = {
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable sudo for the user.
extraGroups = [ "adbusers" "wheel" ];
shell = pkgs.zsh;
initialHashedPassword = "$y$j9T$e64bjL7iyVlniEKwKbM9g0$cCn74za0r6L9QMO20Fdxz3/SX0yvhz3Xd6.2BhtbRL1"; # Not a real password

View file

@ -1 +1,2 @@
import ../dk/single_uefi_btrfs.nix { id = "mmc-SN32G_0xfb19ae99"; name = "pindakaas_sd"; }
{ ... } @ args:
import ../dk/single_uefi_btrfs.nix (args // { id = "mmc-SN32G_0xfb19ae99"; name = "pindakaas_sd"; })