snowfallorg / nix-software-center

A simple gtk4/libadwaita software center to easily install and manage nix packages
GNU General Public License v3.0
529 stars 16 forks source link

gets rebuilt after each garbage collection #42

Open Zahrun opened 1 year ago

Zahrun commented 1 year ago

When installed in NixOS via configuration.nix, if I garbage-collect, and then nixos-rebuild, the software-center gets built again. I may want to try the solution mentioned in https://discourse.nixos.org/t/pinned-nixpkgs-keeps-getting-garbage-collected/12912/6 and if that fixes, I'll PR that.

Same goes with nixos-conf-editor.

pinkcreeper100 commented 1 year ago

there is a cachix copied from discord:

For NixOS users add this to your config:

  nix.settings.substituters = [ "https://snowflakeos.cachix.org/" ];
  nix.settings.trusted-public-keys = [
    "snowflakeos.cachix.org-1:gXb32BL86r9bw1kBiw9AJuIkqN49xBvPd1ZW8YlqO70="
  ];
Zahrun commented 1 year ago

Ok thank you for the information. I will try it for some time. Maybe then we can add it to the readme.

Zahrun commented 1 year ago

Hum, this seems to break nixos-conf-editor

nixos-conf-editor-0.1.1-vendor.tar.gz> building '/nix/store/mwdwhrb58iig3qs4gzzksl9vlh9nsx2k-nixos-conf-editor-0.1.1-vendor.tar.gz.drv'
nixos-conf-editor-0.1.1-vendor.tar.gz> unpacking sources
nixos-conf-editor-0.1.1-vendor.tar.gz> unpacking source archive /nix/store/w9cj7n6p0ls01x9wx4rm5ym4xn59xhzw-d0ddxbyalkfbxdbnfa6xprl8g87n8zn1-source
nixos-conf-editor-0.1.1-vendor.tar.gz> source root is d0ddxbyalkfbxdbnfa6xprl8g87n8zn1-source
nixos-conf-editor-0.1.1-vendor.tar.gz> patching sources
nixos-conf-editor-0.1.1-vendor.tar.gz> configuring
nixos-conf-editor-0.1.1-vendor.tar.gz> no configure script, doing nothing
nixos-conf-editor-0.1.1-vendor.tar.gz> building
nixos-conf-editor-0.1.1-vendor.tar.gz> source = "git+https://github.com/snowflakelinux/nix-data#a75a234c2ffa661b6d3f6d276dc372677e5e2c74"
nixos-conf-editor-0.1.1-vendor.tar.gz> 
nixos-conf-editor-0.1.1-vendor.tar.gz> ERROR: The Cargo.lock contains git dependencies
nixos-conf-editor-0.1.1-vendor.tar.gz> 
nixos-conf-editor-0.1.1-vendor.tar.gz> This is currently not supported in the fixed-output derivation fetcher.
nixos-conf-editor-0.1.1-vendor.tar.gz> Use cargoLock.lockFile / importCargoLock instead.
nixos-conf-editor-0.1.1-vendor.tar.gz> 
error: builder for '/nix/store/mwdwhrb58iig3qs4gzzksl9vlh9nsx2k-nixos-conf-editor-0.1.1-vendor.tar.gz.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/izkzwi1ci7xyvd15rybq3nwwz81snnc7-nixos-conf-editor-0.1.1.drv' failed to build

EDIT: not related, I just can't build nixos-conf-editor for some reason

Zahrun commented 1 year ago

there is a cachix copied from discord:

For NixOS users add this to your config:

  nix.settings.substituters = [ "https://snowflakeos.cachix.org/" ];
  nix.settings.trusted-public-keys = [
    "snowflakeos.cachix.org-1:gXb32BL86r9bw1kBiw9AJuIkqN49xBvPd1ZW8YlqO70="
  ];

Now that I added the cachix, everytime I do a garbage collection and then a rebuild, the sources get downloaded again. At least it is not rebuilding, so it is definitly an improvement. Is there any way to pin the sources in the store, so that they don't get garbage collected?

source> building '/nix/store/r4q7irab4dhzm2k6dmkamdyn4pd28n26-source.drv'
source> 
source> trying https://github.com/vlinkz/nixos-conf-editor/archive/9be2ed1183ca1cdf9c3a7a437032f41241d7a3b5.tar.gz
source>   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
source>                                  Dload  Upload   Total   Spent    Left  Speed
source>   0     0    0     0    0     0      0      0 --:--:--  0:00:16 --:--:--     0
source> 100  680k    0  680k    0     0  12360      0 --:--:--  0:00:56 --:--:-- 24783
source> unpacking source archive /build/9be2ed1183ca1cdf9c3a7a437032f41241d7a3b5.tar.gz
source> building '/nix/store/ybj6x2px1g8x6f75rq1xiqsnkbk4n667-source.drv'
source> 
source> trying https://github.com/vlinkz/nix-software-center/archive/0.1.2.tar.gz
source>   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
source>                                  Dload  Upload   Total   Spent    Left  Speed
source>   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
source> 100 1244k    0 1244k    0     0  25458      0 --:--:--  0:00:50 --:--:-- 19756
source> unpacking source archive /build/0.1.2.tar.gz
source> building '/nix/store/xzavfdvayccwd09y33wz9jni4yianh34-source.drv'
source> 
source> trying https://github.com/vlinkz/nixos-appstream-data/archive/66b3399e6d81017c10265611a151d1109ff1af1b.tar.gz
source>   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
source>                                  Dload  Upload   Total   Spent    Left  Speed
source>   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
source> 100 16.0M    0 16.0M    0     0   794k      0 --:--:--  0:00:20 --:--:--  774k
source> unpacking source archive /build/66b3399e6d81017c10265611a151d1109ff1af1b.tar.gz
jakehamilton commented 1 year ago

@Zahrun can you share your full configuration file(s)? Garbage collection will only remove packages that don't have a gc root. If you're installing the package in your NixOS configuration it won't be garbage collected as long as that system generation is active.

Zahrun commented 1 year ago

The package is not garbage collected, but the source is. My config file is more than 600 lines long, but the relevant part is this:

{ config, pkgs, lib, ... }:
let
  nix-software-center = import (pkgs.fetchFromGitHub {
    owner = "vlinkz";
    repo = "nix-software-center";
    rev = "0.1.2";
    sha256 = "xiqF1mP8wFubdsAQ1BmfjzCgOD3YZf7EGWl9i69FTls=";
  }) {};
  nixos-conf-editor = import (pkgs.fetchFromGitHub {
    owner = "vlinkz";
    repo = "nixos-conf-editor";
    rev = "9be2ed1183ca1cdf9c3a7a437032f41241d7a3b5";
    sha256 = "sha256-QOigD8CaueznOKjjTpz1+lwiOX1o6qPTgZE6GmrCL/o=";
  }) {};
in 
{
  nix.settings.substituters = [ "https://snowflakeos.cachix.org/" ];
  nix.settings.trusted-public-keys = [
    "snowflakeos.cachix.org-1:gXb32BL86r9bw1kBiw9AJuIkqN49xBvPd1ZW8YlqO70="
  ];
  environment.systemPackages = with pkgs; [
    nixos-conf-editor
    nix-software-center
  ];
}
jakehamilton commented 1 year ago

@Zahrun I wonder if setting keep-outputs in your nix.conf is the answer?

{
  nix.settings.keep-outputs = true;
}

https://nixos.org/manual/nix/unstable/command-ref/conf-file.html#conf-keep-outputs

Zahrun commented 1 year ago

@jakehamilton it does not change the situation. https://discourse.nixos.org/t/pinned-nixpkgs-keeps-getting-garbage-collected/12912 reports a similar situation. I was not able to apply his solution though.

eclairevoyant commented 11 months ago

may become irrelevant with #45