a lot more changes to get it to work on hpm

This commit is contained in:
Sebastian Moser
2023-10-31 16:14:10 +00:00
parent 197a40364c
commit 91f23c5632
24 changed files with 403 additions and 343 deletions

View File

@@ -1,12 +1,48 @@
{}:
{ inputs, self, secretsDir, specialArgs, ... }:
# config that i use on all my hosts
{
imports = [
inputs.home-manager.nixosModules.home-manager
../mods/my-nixpkgs-overlay.nix
];
home-manager.extraSpecialArgs = specialArgs;
# set root user pwd
users.users.root.passwordFile = "${secretsDir}/main-root-pwd";
# Set your time zone.
time.timeZone = "Europe/Vienna";
users.mutableUsers = false;
# add mybin to path
environment.etc.profile.text = ''
export PATH=$PATH:${self}/mybin
'';
nixpkgs.config.allowUnfree = true;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
home-manager.backupFileExtension = "backup";
security.sudo.wheelNeedsPassword = false;
users.mutableUsers = false;
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# 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 = "23.05"; # Did you read the comment?
}

View File

@@ -0,0 +1,87 @@
{ self, pkgs, ... }:
{
imports = [
../mods/battery_monitor.nix
];
modules.battery_monitor.enable = true;
# Enable the X11 windowing system.
services.xserver = {
enable = true;
displayManager = {
defaultSession = "none+xmonad";
sessionCommands = ''
xmobar ${self}/misc/xmobar.hs &
# aparently needed, so that xmonad works
sleep 2 && \
${pkgs.xorg.xmodmap}/bin/xmodmap \
-e "clear control" \
-e "clear mod1" \
-e "keycode 64 = Control_L" \
-e "keycode 37 = Alt_L" \
-e "add control = Control_L" \
-e "add mod1 = Alt_L" \
&
'';
};
displayManager.lightdm = {
enable = true;
greeters.enso = {
enable = true;
blur = true;
extraConfig = ''
default-wallpaper=/usr/share/streets_of_gruvbox.png
'';
};
};
layout = "at";
};
# xdg portals
xdg.portal = {
enable = true;
extraPortals = [
#pkgs.xdg-desktop-portal-gtk
#pkgs.xdg-desktop-portal-termfilechooser
(pkgs.callPackage ../mods/xdg-desktop-portal-termfilechooser/default.nix {})
];
};
# Configure keymap in X11
# services.xserver.xkbOptions = "eurosign:e,caps:escape";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
sound.enable = true;
hardware.pulseaudio.enable = true;
services.blueman.enable = true;
hardware.bluetooth.enable = true;
# Enable touchpad support (enabled default in most desktopManager).
services.xserver.libinput.enable = true;
# xmonad
services.xserver.windowManager.xmonad = {
enable = true;
#config = builtins.toPath "${self}/misc/xmonad.hs";
config = builtins.readFile (self + /misc/xmonad.hs);
#config = "${confDir}/misc/xmo";
enableContribAndExtras = true;
extraPackages = hpkgs: [
hpkgs.xmobar
#hpkgs.xmonad-screenshot
];
ghcArgs = [
"-hidir /tmp" # place interface files in /tmp, otherwise ghc tries to write them to the nix store
"-odir /tmp" # place object files in /tmp, otherwise ghc tries to write them to the nix store
#"-i${xmonad-contexts}" # tell ghc to search in the respective nix store path for the module
];
};
}

View File

@@ -1,4 +1,4 @@
{}:
{ ... }:
# config that i use on all my hosts, that run native nixos
# excluding for example my phone phone
@@ -12,6 +12,5 @@
#keyMap = "at";
useXkbConfig = true; # use xkbOptions in tty.
};
}

View File

@@ -1,12 +0,0 @@
{ inputs, self, ... }:
{
home-manager.users.me = { ... }: {
imports = [
inputs.nix-doom-emacs.hmModule
];
programs.doom-emacs = {
enable = true;
doomPrivateDir = "${self}/common/programs/emacs";
};
};
}

View File

@@ -35,7 +35,7 @@
persistentDir = "/home/me/work/app-data";
in
{
nixosConfigurations = {
nixosConfigurations = rec {
"c2vi-main" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
@@ -52,7 +52,7 @@
specialArgs = { inherit inputs confDir workDir secretsDir persistentDir self; };
modules = [
./hosts/main.nix
./hosts/hpm.nix
./hardware/hpm-laptop.nix
];
};
@@ -67,6 +67,7 @@
};
packages.x86_64-linux = {
cbm = nixpkgs.x86_64.callPackage ./mods/cbm.nix { };
#default... TODO
};
};

11
hosts/hpm.nix Normal file
View File

@@ -0,0 +1,11 @@
{ inputs, ... }:
{
imports = [
../common/all.nix
../common/nixos.nix
../common/nixos-graphical.nix
../users/me/default.nix
];
}

View File

@@ -1,5 +1,5 @@
{ pkgs, lib, workDir, confDir, inputs, ... }:
{ pkgs, lib, workDir, self, secretsDir, ... }:
{
# https://bugzilla.kernel.org/show_bug.cgi?id=110941
@@ -11,39 +11,83 @@
# fileSystems."/".options = [ "noatime" "nodiratime" "discard" ];
############################# BOOT #############################
# boot
imports = [
../mods/battery_monitor.nix
../mods/my-nixpkgs-overlay.nix
inputs.home-manager.nixosModules.home-manager
../common/all.nix
../common/nixos.nix
../common/nixos-graphical.nix
../users/me/home.nix
../users/me/default.nix
];
#home-manager.users.me = import ../users/me/home.nix;
############################# MISC #############################
# misc
networking.hostName = "c2vi-main"; # Define your hostname.
# some bind mounts
fileSystems."${workDir}/priv-share/things" = {
device = "${workDir}/things";
options = [ "bind" ];
};
fileSystems."${workDir}/things/htl" = {
device = "${workDir}/htl";
options = [ "bind" ];
};
fileSystems."${workDir}/things/diplomarbeit" = {
device = "${workDir}/diplomarbeit";
options = [ "bind" ];
};
# syncthing for main
services.syncthing = {
enable = true;
user = "me";
#dataDir = "/home/";
configDir = "/home/me/.config/syncthing";
extraFlags = ["-no-browser"];
openDefaultPorts = true;
overrideDevices = true; # overrides any devices added or deleted through the WebUI
overrideFolders = true; # overrides any folders added or deleted through the WebUI
devices = {
"seb-phone" = {
id = builtins.readFile "${secretsDir}/syncthing-id-phone";
#addresses = [ "tcp://192.168.200.24:22000" ];
};
"seb-tab" = {
id = builtins.readFile "${secretsDir}/syncthing-id-tab";
#addresses = [ "tcp://192.168.200.26:22000" ];
};
};
folders = {
"priv-share" = { # Name of folder in Syncthing, also the folder ID
path = "/home/me/work/priv-share"; # Which folder to add to Syncthing
#devices = [ "seb-phone" "seb-tab" ]; # Which devices to share the folder with
devices = [ "seb-phone" "seb-tab" ]; # Which devices to share the folder with
};
};
};
nixpkgs.config.permittedInsecurePackages = [
"electron-24.8.6"
];
security.polkit.enable = true;
networking.firewall.enable = true;
networking.firewall.allowPing = true;
services.samba.openFirewall = true;
# samba
services.samba-wsdd.enable = true; # make shares visible for windows 10 clients
networking.firewall.allowedTCPPorts = [
5357 # wsdd
8888 # for general usage
9999 # for general usage
];
networking.firewall.allowedUDPPorts = [
3702 # wsdd
];
@@ -81,13 +125,10 @@
};
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nixpkgs.config.allowUnfree = true;
security.sudo.wheelNeedsPassword = false;
virtualisation.libvirtd.enable = true;
programs.dconf.enable = true;
system.activationScripts.setupLibvirt = lib.stringAfter [ "var" ] ''
ln -nsf ${workDir}/vm/libvirt/my-image-pool.xml /var/lib/libvirt/storage/my-image-pool.xml
ln -nsf ${workDir}/vm/qemu/* /var/lib/libvirt/qemu/
@@ -97,30 +138,8 @@
ln -nsf /run/current-system/sw/bin/bash /bin/bash
'';
environment.etc.profile.text = ''
export PATH=$PATH:${confDir}/mybin
'';
modules.battery_monitor.enable = true;
xdg.portal = {
enable = true;
extraPortals = [
#pkgs.xdg-desktop-portal-gtk
#pkgs.xdg-desktop-portal-termfilechooser
(pkgs.callPackage ../mods/xdg-desktop-portal-termfilechooser/default.nix {})
];
};
networking.hostName = "c2vi-main"; # Define your hostname.
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
services.blueman.enable = true;
hardware.bluetooth.enable = true;
################
# swap and hibernate
swapDevices = [ { device = "/dev/lvm0/swap"; } ];
boot.resumeDevice = "/dev/lvm0/swap";
services.logind = {
@@ -136,69 +155,14 @@ export PATH=$PATH:${confDir}/mybin
HibernateMode=shutdown
'';
# Enable the X11 windowing system.
services.xserver = {
enable = true;
displayManager = {
defaultSession = "none+xmonad";
sessionCommands = ''
xmobar ${confDir}/xmonad/xmobar.hs &
# aparently needed, so that xmonad works
sleep 2 && \
${pkgs.xorg.xmodmap}/bin/xmodmap \
-e "clear control" \
-e "clear mod1" \
-e "keycode 64 = Control_L" \
-e "keycode 37 = Alt_L" \
-e "add control = Control_L" \
-e "add mod1 = Alt_L" \
&
'';
};
displayManager.lightdm = {
enable = true;
greeters.enso = {
enable = true;
blur = true;
extraConfig = ''
default-wallpaper=/usr/share/streets_of_gruvbox.png
'';
};
};
layout = "at";
};
# Configure keymap in X11
# services.xserver.xkbOptions = "eurosign:e,caps:escape";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
sound.enable = true;
hardware.pulseaudio.enable = true;
# Enable touchpad support (enabled default in most desktopManager).
services.xserver.libinput.enable = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
# List packages installed in system profile.
environment.systemPackages = with pkgs; [
vim # Do not forget to add an editor to edit configuration.nix!
wget
xorg.xmodmap
bluez
];
# 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 = "23.05"; # Did you read the comment?
}

19
mods/cbm.nix Normal file
View File

@@ -0,0 +1,19 @@
{ stdenv
, fetchFromGitHub
, libncurses
}:
stdenv.mkDerivation rec {
pname = "cbm";
version = "0.3.2";
src = fetchFromGitHub {
owner = "resurrecting-open-source-projects";
repo = "cbm";
tag = version;
};
nativeBuildInputs = [
libncurses
];
}

View File

@@ -1,6 +1,6 @@
{ ... }:
{
home-manager.users.me.programs.alacritty = {
programs.alacritty = {
enable = true;
settings = {
font = {

View File

@@ -1,6 +1,6 @@
{ persistentDir, confDir, ... }:
{
home-manager.users.me.programs.bash = {
programs.bash = {
enable = true;
enableCompletion = true;
@@ -259,13 +259,13 @@
function nixre(){
if [ "$1" == "boot" ]
then
nix build github:c2vi/nixos#nixosConfigurations.c2vi-main.config.system.build.toplevel --impure ''${@:2}
sudo ./result/bin/switch-to-configuration boot
rm ./result
nix build github:c2vi/nixos#nixosConfigurations.c2vi-main.config.system.build.toplevel --impure ''${@:2} \
&& sudo ./result/bin/switch-to-configuration boot \
&& rm ./result
else
nix build ~/work/config#nixosConfigurations.c2vi-main.config.system.build.toplevel --impure $@
sudo ./result/bin/switch-to-configuration switch
rm ./result
nix build ~/work/config#nixosConfigurations.c2vi-main.config.system.build.toplevel --impure $@ \
&& sudo ./result/bin/switch-to-configuration switch \
&& rm ./result
fi
}

View File

@@ -0,0 +1,10 @@
{ inputs, self, ... }:
{
imports = [
inputs.nix-doom-emacs.hmModule
];
programs.doom-emacs = {
enable = true;
doomPrivateDir = "${self}/programs/emacs";
};
}

View File

View File

@@ -1,6 +1,6 @@
{ ... }:
{
home-manager.users.me.programs.git = {
programs.git = {
enable = true;
userName = "Sebastian Moser";
userEmail = "me@c2vi.dev";

View File

@@ -1,6 +1,6 @@
{ pkgs, ... }:
{
home-manager.users.me.programs.lf = {
programs.lf = {
package = pkgs.lf.overrideAttrs (final: prev: {
patches = (prev.patches or [ ]) ++ [
./lf-filter.patch

View File

@@ -1,6 +1,6 @@
{ pkgs, ... }:
{
home-manager.users.me.programs.neovim = {
programs.neovim = {
enable = true;
withPython3 = true;
withNodeJs = true;

View File

@@ -1,6 +1,6 @@
{ ... }:
{
home-manager.users.me.programs.rofi = {
programs.rofi = {
enable = true;
theme = "Arc-Dark";
extraConfig = {

View File

@@ -1,6 +1,6 @@
{ secretsDir, ... }:
{
home-manager.users.me.programs.ssh = {
programs.ssh = {
enable = true;
includes = [ "./current_rpi_config" ];
matchBlocks = {
@@ -39,7 +39,7 @@
};
};
home-manager.users.me.home.file.".ssh/rpi/local".text = ''
home.file.".ssh/rpi/local".text = ''
Host config
HostName 192.168.1.2
User config
@@ -74,7 +74,7 @@
IdentityFile ${secretsDir}/private-key-main
'';
home-manager.users.me.home.file.".ssh/rpi/remote".text = ''
home.file.".ssh/rpi/remote".text = ''
Host config
HostName sebastian.dns.army
User config
@@ -109,7 +109,7 @@
IdentityFile ${secretsDir}/private-key-main
'';
home-manager.users.me.home.file.".ssh/rpi/wstunnel".text = ''
home.file.".ssh/rpi/wstunnel".text = ''
Host config
HostName localhost
User config

View File

@@ -1,6 +1,6 @@
{ ... }:
{
home-manager.users.me.programs.zathura = {
programs.zathura = {
enable = true;
options = {
selection-clipboard = "clipboard";

12
users/me/default.nix Normal file
View File

@@ -0,0 +1,12 @@
{ secretsDir, inputs, ... }:
{
users.users.me = {
isNormalUser = true;
passwordFile = "${secretsDir}/main-user-pwd";
extraGroups = [ "networkmanager" "wheel" "libvirtd" ]; # Enable sudo for the user.
};
#home-manager._module.args = { inherit inputs; };
home-manager.users.me = import ./home.nix;
}

View File

@@ -1,34 +1,28 @@
{ pkgs, workDir, confDir, secretsDir, inputs, ... }:
{ config, pkgs, workDir, confDir, secretsDir, inputs, ... }:
{
imports = [
../../common/programs/git.nix
../../common/programs/lf/default.nix
../../common/programs/alacritty.nix
../../common/programs/bash.nix
../../common/programs/emacs/default.nix
../../common/programs/rofi/default.nix
../../common/programs/zathura.nix
../../common/programs/ssh.nix
../../common/programs/neovim.nix
];
home-manager.backupFileExtension = "backup";
home-manager.users.me = { config, pkgs, ... }: {
/* The home.stateVersion option does not have a default and must be set */
# The home.stateVersion option does not have a default and must be set
home.stateVersion = "23.05";
imports = [
inputs.nix-index-database.hmModules.nix-index
# all my programms with their own config
../../programs/git.nix
../../programs/lf/default.nix
../../programs/alacritty.nix
../../programs/bash.nix
../../programs/emacs/default.nix
../../programs/rofi/default.nix
../../programs/zathura.nix
../../programs/ssh.nix
../../programs/neovim.nix
];
programs.nix-index.enable = false;
programs.nix-index.enableBashIntegration = false;
programs.nix-index.enableZshIntegration = false;
#programs.command-not-found.enable = false;
gtk.cursorTheme = {
name = "Yaru";
@@ -58,17 +52,7 @@
''; # documentation for this config file: https://svnbook.red-bean.com/en/1.7/svn.advanced.confarea.html
};
};
fonts.fonts = with pkgs; [
hack-font
];
users.users.me = {
isNormalUser = true;
passwordFile = "${secretsDir}/main-user-pwd";
extraGroups = [ "networkmanager" "wheel" "libvirtd" ]; # Enable sudo for the user.
packages = with pkgs; [
home.packages = with pkgs; [
neovim
vim
obsidian
@@ -121,6 +105,19 @@
android-tools
moonlight-qt
comma
delta
hack-font
inputs.firefox.packages.${pkgs.system}.firefox-nightly-bin
# python....
(python310.withPackages (p: with p; [
pandas
click
click-aliases
]))
(busybox.overrideAttrs (final: prev: {
# get only nslookup from busybox
# because the less would overwrite the actuall less and the busybox does not have -r
@@ -136,16 +133,6 @@
mv $out/busybox $out/bin/busybox
'';
}))
delta
inputs.firefox.packages.${pkgs.system}.firefox-nightly-bin
# python....
(python310.withPackages (p: with p; [
pandas
click
click-aliases
]))
# base-devel
gcc
@@ -164,63 +151,9 @@
virt-manager
freerdp
];
};
# xmonad
services.xserver.windowManager.xmonad = {
enable = true;
config = ../../misc/xmonad.hs;
#config = "${confDir}/misc/xmo";
enableContribAndExtras = true;
extraPackages = hpkgs: [
hpkgs.xmobar
#hpkgs.xmonad-screenshot
];
ghcArgs = [
"-hidir /tmp" # place interface files in /tmp, otherwise ghc tries to write them to the nix store
"-odir /tmp" # place object files in /tmp, otherwise ghc tries to write them to the nix store
#"-i${xmonad-contexts}" # tell ghc to search in the respective nix store path for the module
];
};
services.syncthing = {
enable = true;
user = "me";
#dataDir = "/home/";
configDir = "/home/me/.config/syncthing";
extraFlags = ["-no-browser"];
openDefaultPorts = true;
overrideDevices = true; # overrides any devices added or deleted through the WebUI
overrideFolders = true; # overrides any folders added or deleted through the WebUI
devices = {
"seb-phone" = {
id = builtins.readFile "${secretsDir}/syncthing-id-phone";
#addresses = [ "tcp://192.168.200.24:22000" ];
};
"seb-tab" = {
id = builtins.readFile "${secretsDir}/syncthing-id-tab";
#addresses = [ "tcp://192.168.200.26:22000" ];
};
};
folders = {
"priv-share" = { # Name of folder in Syncthing, also the folder ID
path = "/home/me/work/priv-share"; # Which folder to add to Syncthing
#devices = [ "seb-phone" "seb-tab" ]; # Which devices to share the folder with
devices = [ "seb-phone" "seb-tab" ]; # Which devices to share the folder with
};
};
};
fileSystems."${workDir}/priv-share/things" = {
device = "${workDir}/things";
options = [ "bind" ];
};
fileSystems."${workDir}/things/htl" = {
device = "${workDir}/htl";
options = [ "bind" ];
};
fileSystems."${workDir}/things/diplomarbeit" = {
device = "${workDir}/diplomarbeit";
options = [ "bind" ];
};
}
#fonts.fonts = with pkgs; [
#hack-font
#];