just make nix-conf works for now

pull/1/head
Pegasust 2022-12-27 19:08:07 -07:00
parent 43942e2fe0
commit b22ef28604
5 changed files with 118 additions and 56 deletions

View File

@ -89,11 +89,11 @@
"utils": "utils"
},
"locked": {
"lastModified": 1671958483,
"narHash": "sha256-wX+VBdHwrpW654PzmM4efiPdUDI8da8TGZeQt/zYP40=",
"lastModified": 1671966569,
"narHash": "sha256-jbLgfSnmLchARBNFRvCic63CFQ9LAyvlXnBpc2kwjQc=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "939731b8cb75fb451170cb8f935186a6a7424444",
"rev": "c55fa26ce05fee8e063db22918d05a73d430b2ea",
"type": "github"
},
"original": {
@ -138,11 +138,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1671722432,
"narHash": "sha256-ojcZUekIQeOZkHHzR81st7qxX99dB1Eaaq6PU5MNeKc=",
"lastModified": 1671983799,
"narHash": "sha256-Z2Ro6hFPZHkBqkVXY5/aBUzxi5xizQGvuHQ9+T5B/ks=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "652e92b8064949a11bc193b90b74cb727f2a1405",
"rev": "fad51abd42ca17a60fc1d4cb9382e2d79ae31836",
"type": "github"
},
"original": {
@ -184,11 +184,11 @@
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1671935094,
"narHash": "sha256-fWEkH5550R6q6+CeG/317g9ywE/ZhW/4zuCjTaDsHe8=",
"lastModified": 1672107670,
"narHash": "sha256-m4kP+8k46JwSXYDugykIVvRyoNofZDG7atjbi5+sLoU=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "fd2740316bacb3e0106381c325e0bb90d6790aeb",
"rev": "f4827ef0518463f31a52ab2e5c500c80558fdd78",
"type": "github"
},
"original": {

View File

@ -0,0 +1,48 @@
{ config, pkgs, lib, ... }:
let cfg = config.base.private_chromium;
in
{
options.base.private_chromium = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
example = false;
description = ''
Enable extremely lightweight chromium with vimium plugin
'';
};
};
config = lib.mkIf cfg.enable {
# home.packages = [pkgs.ungoogled-chromium];
programs.chromium = {
enable = true;
package = pkgs.ungoogled-chromium;
extensions =
let
mkChromiumExtForVersion = browserVersion: { id, sha256, extVersion, ... }:
{
inherit id;
crxPath = builtins.fetchurl {
url = "https://clients2.google.com/service/update2/crx" +
"?response=redirect" +
"&acceptformat=crx2,crx3" +
"&prodversion=${browserVersion}" +
"&x=id%3D${id}%26installsource%3Dondemand%26uc";
name = "${id}.crx";
inherit sha256;
};
version = extVersion;
};
mkChromiumExt = mkChromiumExtForVersion (lib.versions.major pkgs.ungoogled-chromium.version);
in
[
# vimium
(mkChromiumExt {
id = "dbepggeogbaibhgnhhndojpepiihcmeb";
sha256 = "00qhbs41gx71q026xaflgwzzridfw1sx3i9yah45cyawv8q7ziic";
extVersion = "1.67.4";
})
];
};
};
}

View File

@ -0,0 +1,9 @@
inputs@{pkgs,...}: {
imports = [
# slack
({pkgs,...}: {
home.packages = [pkgs.slack];
})
./private_chromium.nix
];
}

View File

@ -35,52 +35,7 @@
# lib = (import ../lib { inherit pkgs; lib = pkgs.lib; });
base = import ./base;
inherit (base) mkModuleArgs;
private_chromium = {config, pkgs, lib, ...}: let cfg = config.base.private_chromium;
in {
options.base.private_chromium = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
example = false;
description = ''
Enable extremely lightweight chromium with vimium plugin
'';
};
};
config = lib.mkIf cfg.enable {
# home.packages = [pkgs.ungoogled-chromium];
programs.chromium = {
enable = true;
package = pkgs.ungoogled-chromium;
extensions =
let
mkChromiumExtForVersion = browserVersion: {id, sha256, extVersion,...}:
{
inherit id;
crxPath = builtins.fetchurl {
url = "https://clients2.google.com/service/update2/crx"+
"?response=redirect"+
"&acceptformat=crx2,crx3"+
"&prodversion=${browserVersion}"+
"&x=id%3D${id}%26installsource%3Dondemand%26uc";
name = "${id}.crx";
inherit sha256;
};
version = extVersion;
};
mkChromiumExt = mkChromiumExtForVersion (lib.versions.major pkgs.ungoogled-chromium.version);
in
[
# vimium
(mkChromiumExt {
id = "dbepggeogbaibhgnhhndojpepiihcmeb";
sha256 = "00qhbs41gx71q026xaflgwzzridfw1sx3i9yah45cyawv8q7ziic";
extVersion = "1.67.4";
})
];
};
};
};
kde_module = {config, pkgs, ...}: {
fonts.fontconfig.enable = true;
home.packages = [
@ -121,7 +76,7 @@
modules = base.modules ++ [
./home.nix
kde_module
private_chromium
./base/productive_desktop.nix
];
# optionally pass inarguments to module
# we migrate this from in-place modules to allow flexibility

50
scripts/config-sysnix-edge.sh Executable file
View File

@ -0,0 +1,50 @@
#!/usr/bin/env sh
## Configures a new nixos system to this repository
## Blame: Hung Tran (Pegasust) <pegasucksgg@gmail.com>
set -xv
HOSTNAME=${1}
if [ -z $HOSTNAME ]; then
current_hostname=$(hostname)
echo "Missing hostname as first param."
echo "Type the hostname you want to be here"
read -p "[${current_hostname}] > " HOSTNAME
HOSTNAME=${HOSTNAME:-${current_hostname}}
read -p "Using hostname: ${HOSTNAME}. Press ENTER to continue." _WHATEVER_
fi
# Where is this script located
SCRIPT_DIR=$(realpath $(dirname $0))
echo "SCRIPT_DIR: ${SCRIPT_DIR}"
SYSNIX_DIR="${SCRIPT_DIR}/.."
# Copy hardware-configuration of existing machine onto our version control
SYSNIX_PROF="${SYSNIX_DIR}/hosts/${HOSTNAME}"
HARDWARE_CONF="${SYSNIX_PROF}/hardware-configuration.nix"
if [ ! -f "${HARDWARE_CONF}" ]; then
mkdir "$SYSNIX_PROF"
sudo cp /etc/nixos/hardware-configuration.nix ${HARDWARE_CONF}
fi
git add "${HARDWARE_CONF}"
# Copy ssh/id-rsa details onto ssh/authorized_keys
SSH_PRIV="${HOME}/.ssh/id_rsa"
SSH_PUB="${SSH_PRIV}.pub"
SSH_DIR="${SCRIPT_DIR}/../native_configs/ssh"
if [ ! -f "${SSH_PRIV}" ]; then
ssh-keygen -b 2048 -t rsa -f "${SSH_PRIV}" -q -N ""
fi
# idempotently adds to authorized_keys
cat "${SSH_PUB}" >> "${SSH_DIR}/authorized_keys"
# sort "${SSH_DIR}/authorized_keys" | uniq >"${SSH_DIR}/authorized_keys"
# NOTE: if we do sort... file >file, the ">file" is performed first, which truncates
# the file before we open to read. Hence, `sort [...] file >file` yields empty file.
# Because of this, we have to use `-o`
sort -u "${SSH_DIR}/authorized_keys" -o "${SSH_DIR}/authorized_keys"
echo "Apply nixos-rebuild"
sudo nixos-rebuild switch --flake "${SYSNIX_DIR}#${HOSTNAME}"