Limit graphical programs by hostname

old-yadm
earnest ma 2021-08-14 13:36:11 -04:00
parent 7d1d1388b4
commit 533da03db0
Signed by: earnest ma
GPG Key ID: A343F43342EB6E2A
3 changed files with 49 additions and 12 deletions

View File

@ -0,0 +1,20 @@
{ pkgs, ... }:
let
pkgsUnstable = import <nixpkgs-unstable> {};
in
{
home.packages = with pkgs; [
authy
barrier
pkgsUnstable.discord
google-chrome
todoist-electron
pkgsUnstable.zoom-us
pkgsUnstable.logseq
sublime-music
alacritty
];
}

View File

@ -1,6 +1,8 @@
{ config, pkgs, ... }: { config, pkgs, lib, ... }:
let let
inherit (lib) optionals;
hostName = import ./hostname.nix lib;
# Be able to use unstable packages # Be able to use unstable packages
pkgsUnstable = import <nixpkgs-unstable> {}; pkgsUnstable = import <nixpkgs-unstable> {};
@ -10,14 +12,12 @@ in
home.username = "earne"; home.username = "earne";
home.homeDirectory = "/home/earne"; home.homeDirectory = "/home/earne";
home.packages = with pkgs; [ imports =
authy # non-free (optionals (hostName == "tycho") [
barrier ./graphical.nix
pkgsUnstable.discord # non-free ]);
google-chrome # non-free
todoist-electron # non-free
pkgsUnstable.zoom-us # non-free
home.packages = with pkgs; [
# Doom Emacs + dependencies # Doom Emacs + dependencies
pkgsUnstable.fd pkgsUnstable.fd
pkgsUnstable.ripgrep pkgsUnstable.ripgrep
@ -27,10 +27,6 @@ in
isync isync
khard khard
pkgsUnstable.logseq
sublime-music
alacritty
gitFull gitFull
git-extras git-extras
ghq ghq

View File

@ -0,0 +1,21 @@
lib:
let
inherit (builtins) currentSystem;
inherit (lib) maybeEnv fileContents;
inherit (lib.systems.elaborate { system = currentSystem; }) isLinux isDarwin;
in
maybeEnv "HOST" (fileContents (
if !isDarwin then
/etc/hostname
else
derivation {
name = "hostname";
system = currentSystem;
builder = "/bin/sh";
args = [ "-c" "/usr/sbin/scutil --get LocalHostName > $out" ];
}
))