updated postgres

This commit is contained in:
Sam 2024-09-09 11:41:10 +01:00
parent 564d4f6230
commit a8e0ae35da
8 changed files with 160 additions and 125 deletions

View File

@ -1,6 +1,4 @@
{ config
, ...
}: {
{config, ...}: {
imports = [
# Import users
./users/sam
@ -15,7 +13,6 @@
./common/optional/desktop/common/themes/standard-dark.nix
./common/optional/notes.nix
./common/optional/yazi.nix
];
colorScheme = {
@ -72,7 +69,7 @@
Nsxiv.window.background: #${config.colorScheme.colors.base03}
Nsxiv.window.foreground: #${config.colorScheme.colors.base05}
Nsxiv.mark.foreground: #${config.colorScheme.colors.base08}
Nsxiv.bar.background: #${config.colorScheme.colors.base00}
Nsxiv.bar.foreground: #${config.colorScheme.colors.base05}
Nsxiv.bar.font: monospace:size=12

View File

@ -17,5 +17,6 @@
pkgs.transmission
pkgs.qgis
pkgs.mpv
pkgs.gnome.simple-scan
];
}

View File

@ -1,27 +1,48 @@
{ pkgs, ... }:
{
{pkgs, ...}: {
# Prevent error when enabling gtk https://github.com/nix-community/home-manager/issues/3113
# error: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name ca.desrt.dconf was not provided by any .service files
home.packages = [
pkgs.dconf
pkgs.vimix-cursor-theme
];
gtk.enable = true;
home.file.".icons/default".source = "${pkgs.vimix-cursor-theme}/share/icons/Vimix-Cursors";
# Get details about theme package
# Get details about theme package
#cd $(nix build nixpkgs#kanagawa-gtk-theme --print-out-paths --no-link) && nix run nixpkgs#eza -- --tree --level 4
gtk.theme.package = pkgs.kanagawa-gtk-theme;
gtk.cursorTheme = {
name = "Vimix-Cursors";
package = pkgs.vimix-cursor-theme;
gtk = {
enable = true;
theme = {
name = "Kanagawa-B";
package = pkgs.kanagawa-gtk-theme;
};
iconTheme = {
package = pkgs.gnome.adwaita-icon-theme;
name = "Adwaita";
};
gtk3.extraConfig = {
Settings = ''
gtk-application-prefer-dark-theme=1
'';
};
gtk4.extraConfig = {
Settings = ''
gtk-application-prefer-dark-theme=1
'';
};
};
gtk.theme.name = "Kanagawa-B";
#gtk.theme.package = pkgs.kanagawa-gtk-theme;
gtk.iconTheme.package = pkgs.kanagawa-icon-theme;
gtk.iconTheme.name = "Kanagawa";
# gtk.cursorTheme = {
# name = "Vimix-Cursors";
# package = pkgs.vimix-cursor-theme;
# };
# gtk.theme.name = "Kanagawa-B";
# gtk.iconTheme.package = pkgs.kanagawa-icon-theme;
# gtk.iconTheme.name = "Kanagawa";
qt.enable = true;
qt.platformTheme.name = "gtk";

View File

@ -1,6 +1,7 @@
{ pkgs
, config
, ...
{
pkgs,
config,
...
}: {
imports = [
# Import users
@ -16,7 +17,6 @@
./common/optional/desktop/common/themes/standard-dark.nix
./common/optional/notes.nix
./common/optional/yazi.nix
];
colorScheme = {
@ -43,14 +43,6 @@
};
};
home.pointerCursor = {
x11.enable = true;
name = "Vimix-Cursors";
package = pkgs.vimix-cursor-theme;
size = 64;
gtk.enable = true;
};
xresources.extraConfig = ''
! st
st.alpha: 0.8
@ -79,10 +71,9 @@
Nsxiv.window.background: #${config.colorScheme.colors.base03}
Nsxiv.window.foreground: #${config.colorScheme.colors.base05}
Nsxiv.mark.foreground: #${config.colorScheme.colors.base08}
Nsxiv.bar.background: #${config.colorScheme.colors.base00}
Nsxiv.bar.foreground: #${config.colorScheme.colors.base05}
Nsxiv.bar.font: monospace:size=12
'';
}

View File

@ -1,9 +1,9 @@
{ pkgs, ... }:
{
{pkgs, ...}: {
services = {
udev.packages = [pkgs.sane-airscan];
printing = {
enable = true;
drivers = [ pkgs.gutenprint pkgs.hplip ];
drivers = [pkgs.gutenprint pkgs.hplip];
};
avahi = {
enable = true;
@ -11,18 +11,26 @@
openFirewall = true;
};
};
hardware.printers = {
ensurePrinters = [
{
name = "HP_ENVY_6000";
description = "Network printer hosted on bob";
location = "bob";
deviceUri = "ipp://bob/printers/HP_ENVY_6000_series";
model = "everywhere";
ppdOptions = {
PageSize = "A4";
};
}
];
hardware = {
sane = {
enable = true;
extraBackends = [pkgs.sane-airscan];
netConf = "10.0.10.2";
};
printers = {
ensurePrinters = [
{
name = "HP_ENVY_6000";
description = "Network printer hosted on bob";
location = "bob";
deviceUri = "ipp://bob/printers/HP_ENVY_6000_series";
model = "everywhere";
ppdOptions = {
PageSize = "A4";
};
}
];
};
};
}

View File

@ -1,24 +1,28 @@
{ pkgs, inputs, config, lib, ... }:
let
{
pkgs,
inputs,
config,
lib,
...
}: let
username = "media";
pubKeys = lib.filesystem.listFilesRecursive (../keys);
pubKeys = lib.filesystem.listFilesRecursive ../keys;
hostname = config.networking.hostName;
sopsHashedPasswordFile = lib.optionalString (lib.hasAttr "sops-nix" inputs) config.sops.secrets."passwords/${username}".path;
secretsDirectory = builtins.toString inputs.nix-secrets;
secretsFile = "${secretsDirectory}/secrets.yaml";
in
{
in {
users.users.${username} = {
isNormalUser = true;
shell = pkgs.zsh; # default shell
hashedPasswordFile = sopsHashedPasswordFile;
openssh.authorizedKeys.keys = lib.lists.forEach pubKeys (key: builtins.readFile key);
extraGroups =
[
"wheel"
];
extraGroups = [
"scanner"
"lp"
"wheel"
];
packages = with pkgs; [
flatpak
@ -65,16 +69,14 @@ in
# The containing ssh folders are created as root and if this is the first ~/.ssh/ entry when writing keys,
# the ownership is busted and home-manager can't target because it can't write into .ssh...
# FIXME: We might not need this depending on how https://github.com/Mic92/sops-nix/issues/381 is fixed
system.activationScripts.sopsSetSshOwnwership =
let
sshFolder = "/home/${username}/.ssh";
user = config.users.users.${username}.name;
group = config.users.users.${username}.group;
in
''
mkdir -p ${sshFolder} || true
chown -R ${user}:${group} /home/${username}/.ssh
'';
system.activationScripts.sopsSetSshOwnwership = let
sshFolder = "/home/${username}/.ssh";
user = config.users.users.${username}.name;
group = config.users.users.${username}.group;
in ''
mkdir -p ${sshFolder} || true
chown -R ${user}:${group} /home/${username}/.ssh
'';
services.flatpak.enable = true;
@ -82,7 +84,7 @@ in
programs.fuse.userAllowOther = true;
home-manager = {
extraSpecialArgs = { inherit inputs; };
extraSpecialArgs = {inherit inputs;};
users = {
${username} = import ../../../../home/${hostname}.nix;
};

View File

@ -1,13 +1,17 @@
{ pkgs, inputs, config, lib, ... }:
let
{
pkgs,
inputs,
config,
lib,
...
}: let
hostname = config.networking.hostName;
pubKeys = lib.filesystem.listFilesRecursive (../keys);
pubKeys = lib.filesystem.listFilesRecursive ../keys;
sopsHashedPasswordFile = lib.optionalString (lib.hasAttr "sops-nix" inputs) config.sops.secrets."passwords/sam".path;
secretsDirectory = builtins.toString inputs.nix-secrets;
secretsFile = "${secretsDirectory}/secrets.yaml";
username = "sam";
in
{
in {
users.users.${username} = {
isNormalUser = true;
shell = pkgs.zsh; # default shell
@ -17,8 +21,9 @@ in
extraGroups = [
"wheel"
"networkmanager"
"scanner"
"lp"
];
};
sops.secrets = {
@ -39,15 +44,15 @@ in
"github-access-token" = {
mode = "0655";
};
"software/postgres/btc_models/password" = { };
"software/postgres/btc_models/ip" = { };
"software/postgres/btc_models/username" = { };
"software/postgres/osm/password" = { };
"software/postgres/osm/ip" = { };
"software/postgres/osm/username" = { };
"software/zotero/username" = { };
"software/zotero/password" = { };
"software/zotero/guid" = { };
"software/postgres/btc_models/password" = {};
"software/postgres/btc_models/ip" = {};
"software/postgres/btc_models/username" = {};
"software/postgres/osm/password" = {};
"software/postgres/osm/ip" = {};
"software/postgres/osm/username" = {};
"software/zotero/username" = {};
"software/zotero/password" = {};
"software/zotero/guid" = {};
};
# Setup software specific templates for user
@ -102,7 +107,7 @@ in
threads: 6
type: postgres
user: ${config.sops.placeholder."software/postgres/btc_models/username"}
'';
};
@ -115,16 +120,14 @@ in
# The containing folders are created as root and if this is the first entry when writing files,
# the ownership is busted and home-manager can't target because it can't write to these dirs...
# FIXME: We might not need this depending on how https://github.com/Mic92/sops-nix/issues/381 is fixed
system.activationScripts.sopsSetOwnwership =
let
sshFolder = "/home/${username}/.ssh";
user = config.users.users.${username}.name;
group = config.users.users.${username}.group;
in
''
mkdir -p ${sshFolder} || true
chown -R ${user}:${group} /home/${username}/.ssh
'';
system.activationScripts.sopsSetOwnwership = let
sshFolder = "/home/${username}/.ssh";
user = config.users.users.${username}.name;
group = config.users.users.${username}.group;
in ''
mkdir -p ${sshFolder} || true
chown -R ${user}:${group} /home/${username}/.ssh
'';
environment.persistence."/persist" = {
directories = [
@ -135,7 +138,7 @@ in
programs.zsh.enable = true;
home-manager = {
extraSpecialArgs = { inherit inputs; };
extraSpecialArgs = {inherit inputs;};
users = {
${username} = import ../../../../home/${hostname}.nix;
};

View File

@ -1,43 +1,55 @@
{ inputs, lib, pkgs, ... }:
let
{
inputs,
lib,
pkgs,
...
}: let
# Disko setup
fsType = "btrfs"; # one of ext4 or btrfs. Use btrfs if using impermanence
dev = "/dev/nvme0n1"; # depends on target hardware
encrypted = true; # currrently only applies to btrfs
btrfsMountDevice = if encrypted then "/dev/mapper/crypted" else "/dev/root_vg/root";
btrfsMountDevice =
if encrypted
then "/dev/mapper/crypted"
else "/dev/root_vg/root";
user = "sam";
impermanence = true;
in
{
imports =
[
# Create users for this host
../common/users/${user}
in {
imports = [
# Create users for this host
../common/users/${user}
# Disk configuration
inputs.disko.nixosModules.disko
(import ../common/disks { device = dev; impermanence = impermanence; fsType = fsType; encrypted = encrypted; })
# Disk configuration
inputs.disko.nixosModules.disko
(import ../common/disks {
device = dev;
impermanence = impermanence;
fsType = fsType;
encrypted = encrypted;
})
# Impermanence
(import ../common/disks/btrfs/impermanence.nix { btrfsMountDevice = btrfsMountDevice; lib = lib; })
# Impermanence
(import ../common/disks/btrfs/impermanence.nix {
btrfsMountDevice = btrfsMountDevice;
lib = lib;
})
# Import core options
./hardware-configuration.nix
../common/core
# Import core options
./hardware-configuration.nix
../common/core
# Import optional options
../common/optional/persistence.nix
../common/optional/pipewire.nix
../common/optional/openssh.nix
../common/optional/dwm.nix
../common/optional/nfs-mounts/media.nix
../common/optional/nfs-mounts/homeshare.nix
../common/optional/printing.nix
];
# Import optional options
../common/optional/persistence.nix
../common/optional/pipewire.nix
../common/optional/openssh.nix
../common/optional/dwm.nix
../common/optional/nfs-mounts/media.nix
../common/optional/nfs-mounts/homeshare.nix
../common/optional/printing.nix
];
boot = {
blacklistedKernelModules = [ "snd_hda_intel" "snd_soc_skl" ];
blacklistedKernelModules = ["snd_hda_intel" "snd_soc_skl"];
kernelPackages = pkgs.linuxPackagesFor pkgs.linux_latest;
loader = {
systemd-boot.enable = true;
@ -69,7 +81,7 @@ in
hostName = "semita";
networkmanager.enable = true;
enableIPv6 = false;
nameservers = [ "10.0.10.60" "8.8.8.8" ];
nameservers = ["10.0.10.60" "8.8.8.8"];
};
services.libinput.enable = true;