Skyler Grey | 252927a | 2022-10-18 22:18:15 +0100 | [diff] [blame] | 1 | { username |
| 2 | , config |
| 3 | , ... |
Skyler Grey | c2b9ce0 | 2022-08-26 06:46:19 +0100 | [diff] [blame] | 4 | }: { |
Skyler Grey | 56981bd | 2023-04-15 14:35:20 +0000 | [diff] [blame] | 5 | config = { |
| 6 | environment.persistence = { |
| 7 | "/nix/persist".users.${username}.directories = [ |
| 8 | { |
| 9 | directory = ".cache/ccache"; |
| 10 | mode = "0700"; |
| 11 | } |
| 12 | ]; |
| 13 | "/large/persist".directories = [ config.programs.ccache.cacheDir ]; |
| 14 | }; |
| 15 | programs.ccache.enable = true; |
| 16 | /* nixpkgs.config.replaceStdenv = { pkgs }: pkgs.ccacheStdenv; */ |
| 17 | /* nixpkgs.config.allowBroken = true; */ |
| 18 | nix.settings.extra-sandbox-paths = [ config.programs.ccache.cacheDir ]; |
| 19 | nixpkgs.overlays = [ |
| 20 | (self: super: { |
| 21 | ccacheWrapper = super.ccacheWrapper.override { |
| 22 | extraConfig = '' |
| 23 | export CCACHE_COMPRESS=1 |
| 24 | export CCACHE_DIR="${config.programs.ccache.cacheDir}" |
| 25 | export CCACHE_UMASK=007 |
| 26 | if [ ! -d "$CCACHE_DIR" ]; then |
| 27 | echo "=====" |
| 28 | echo "Directory '$CCACHE_DIR' does not exist" |
| 29 | echo "Please create it with:" |
| 30 | echo " sudo mkdir -m0770 '$CCACHE_DIR'" |
| 31 | echo " sudo chown root:nixbld '$CCACHE_DIR'" |
| 32 | echo "=====" |
| 33 | exit 1 |
| 34 | fi |
| 35 | if [ ! -w "$CCACHE_DIR" ]; then |
| 36 | echo "=====" |
| 37 | echo "Directory '$CCACHE_DIR' is not accessible for user $(whoami)" |
| 38 | echo "Please verify its access permissions" |
| 39 | echo "=====" |
| 40 | exit 1 |
| 41 | fi |
| 42 | ''; |
| 43 | }; |
| 44 | }) |
| 45 | ]; |
| 46 | }; |
Skyler Grey | c2b9ce0 | 2022-08-26 06:46:19 +0100 | [diff] [blame] | 47 | } |