gomp

joined 1 year ago
[–] gomp@lemmy.ml 2 points 3 weeks ago

That's the thing you want to build (a single project may generate multiple executables - eg. a server and a client) so it won't help in this case but... I must say, I am impressed and really grateful that you went and looked that up for me! Thanks, mate!

[–] gomp@lemmy.ml 2 points 3 weeks ago

cabal2nix doesn't care about any source-repository-package in cabal.project (I think it doesn't even read that file?).

In my case, it generated a project that depended on the aeon from nixpkgs (which IIUC in turn comes from hackage) rather than the forked version.

[–] gomp@lemmy.ml 2 points 3 weeks ago (2 children)

I agree: flakes are great for development (and not only)!

Unfortunately I still need to build that third party project from source :)
Maybe I should look into disregarding the whole haskellPackages infrastructure and just build with cabal via a shell script.. IDK if that would be accepted in nixpkgs though :/

[–] gomp@lemmy.ml 9 points 3 weeks ago

OP, I forgot to say! There are specific communities dedicated to self hosting and/or home labbing (eg. !selfhosted@lemmy.world), you may want to participate there

[–] gomp@lemmy.ml 5 points 3 weeks ago

Yes, and computers people have laying around are most probably not outdated enterprise servers that draw 120w at idle :)
(if anything, that's something a newbie self hoster may buy since they are cheap and look cool)

[–] gomp@lemmy.ml 15 points 3 weeks ago (2 children)

Cheapest? Use someone else's hrdware (or "borrow" it) and set it up at work/school/friend's house/cafe. Free hardware, free connectivity, free electricity.

More seriously, set everithing up on whatever spare old computer you have at hand (or use a vm running on you pc). You should not start with buying hardware.

[–] gomp@lemmy.ml 3 points 3 weeks ago

The ones I added recently are all git-related (one key for signing and I started using different keys for codehaus, gitlab and github)

[–] gomp@lemmy.ml 6 points 3 weeks ago (4 children)

I did add a bunch of new keys to my ssh agent... this might really be it!

[–] gomp@lemmy.ml 5 points 3 weeks ago

Now that's a neat idea! (not sure I'll ever implement it though: having passwords on my ssh keys is already enough of a hassle, plus having provisioning and scripts ask for password is a PITA)

Anyway, I was just trying to authenticate with a password, like we used to back in the day :)
(it's only for install isos or freshly installed systems that I've not provisioned yet - everything else requires a key).

[–] gomp@lemmy.ml 2 points 3 weeks ago (1 children)

How would that improve security when all a bad actor has to do is add -o PubkeyAuthentication=no on their side?

Also, I'm pretty sure it used to just ask for a password?

[–] gomp@lemmy.ml 3 points 1 month ago* (last edited 1 month ago)

If the US or EU want to keep up, they can sunbsidize EV manufacturing to the same degree

You can't allow dumping-inducing subsidies without also allowing defensive tariffs, otherwise the richer and more authoritarian countries, which have greater capacity for subsidies and greater ability to concentrate them in specific sectors, will easily kill foreign competition and establish monopolies.

The marketplace brah is a place where, without regulations that maintain a degree of fairness, the rich kills the poor, competition dies off, and consumers are drained to their last cent.

Just think of it: competition is when different actors fight it off and it ends the moment one of the contenders wins.
If you want the fight to go on forever, you don't want an unregulated market.

[–] gomp@lemmy.ml 3 points 1 month ago (1 children)

Subsidizing sales of EVs (ie. I pay for my neighbor's new EV because I want cleaner air) does make environmental sense.

Subsidizing production does not have the same positive environmental impact, mainly because factories in China pollute more than factories, say, in the EU (due to different environmental laws), but also because moving finished products from China to the "west" obviously pollutes more than moving just those components that would need to be sourced from China anyways (eg. batteries).

As for the "makes economic sense" part... IDK: I guess that mainly depend on your political stance.
Personally, I don't like that both sales and production subsidies have the effect of moving money from the poor to the rich, but other people may focus on different effects (eg. more production = more jobs) and support subsides.
In case you wonder: my take is that, instead of incentivizing adoption and production of EVs, one should disincentivize internal combustion vehicles by adding taxes to them (which, in a sense, aren't really taxes but just charging for the very real environmental costs society as a whole will have to pay for your shiny SUV).

Anyone not doing this is an idiot and a climate terrorist.

You should really think twice before spewing judgements... and also avoid misusing words like "terrorist" because, when misused this way, it only conveys that you don't like someone, dulling your message instead of strengthening it.

 

This may be OT since strictly speaking it's about hardware... I trust it is ok to post it given the spirit of the community, but have my apologies and feel free to remove it if it's not.

I'm looking to replace my old Bose QC25, since they have recently died (after a long a fulfilling life), but it seems everything nowadays is bluetooth (which I don't mind) and require some proprietary app to turn ANC on/off (which I do mind... are physical buttons/switches become too expensive to include in your overpriced earbuds?).

Anyway... do you know of any headphones/earbuds that meet the following?

  1. can be powered via wire or have batteries that last 12+hrs (long-haul flights)
  2. have decent noise cancelling
  3. don't require me to install a apps or can be used with some open source app (possibly with full functionality and straightforward to setup)
  4. are not overly expensive (I have to buy 2 pairs and I'll only use them a few times a year when I fly)
 

I want to call the escapeSystemdPath (defined in nixpgs at nixos/lib/utils.nix) to derive the name of a systemd mount unit from the target path (eg. srv-my-dir.mount from /srv/my/dir), but I can't figure out how I can reference it... any ideas?

5
submitted 1 year ago* (last edited 1 year ago) by gomp@lemmy.ml to c/nixos@lemmy.ml
 

I'm playing around with nixos in a few VMs and at some point I realized I must have lost the swap configuration in one of my refactorings.

To my surprise, however, the VMs do use the swap partitions I had set up.

There is no mention on "swap" in my nix configuration (or in fstab) and no .swap units in /etc/systemd/system; I do however have a swap partition labelled "swap".

Turns out there is a systemd unit (albeit not a corresponding file) that sets up swap:

[root@vm1:~]# free -hw
               total        used        free      shared     buffers       cache   available
Mem:           2.8Gi       664Mi       955Mi       4.0Mi       3.0Mi       1.3Gi       2.0Gi
Swap:          3.7Gi          0B       3.7Gi

[root@vm1:~]# systemctl list-dependencies swap.target 
swap.target
● └─dev-disk-by\x2ddiskseq-1\x2dpart3.swap

I'm wondering where the unit comes from? Can I rely on this and never configure swap ever again?

 

Is there an extension that warns you when you are wasting time reading ai-generated crap?

Case in point, I was reading an article that claimed to compare kubernetes distros and wasted some good minutes before realizing it was full of crap.

 

I have an option that must be left with the default value when a certain flag (another option) is false.

I didn't find any example (let alone documentation) on how to implement this, so I've come up with two ideas:

option-that-errors-out-if-set-when-flag-is-false =
let
  default = if config.some-flag
          then "some default value for when flag is true"
          else "value that should not be changed when flag is false";
in lib.mkOption {
  type = lib.types.str;
  inherit default;
  apply = v: assert assertMsg (config.some-flag || v == default) "Do not set this option unless 'flag' is true";
          v;
};
option-that-ignores-value-when-flag-is-false =
let
  default = if config.some-flag
          then "some default value for when flag is true"
          else "value that should not be changed when flag is false";
in lib.mkOption {
  type = lib.types.str;
  inherit default;
  apply = v: if config.some-flag then v else default;
};

Which one do you think is "best" (cleaner, more idiomatic, etc..)?

Is apply the "right" place to validate options? Should I make a custom type instead? Should I approach this in some different way?

5
submitted 1 year ago* (last edited 1 year ago) by gomp@lemmy.ml to c/nixos@lemmy.ml
 

I'd like to set a "global" option from within a submodule, but the config I return is grafted into the "global" under the submodule "path" rather than at the root... any idea if it's somehow possible?

Er... I guess I didn't make a great job at explaining what I want to do... Some code will hopefully help.

In mymodule.nix I have:

{ lib, config, ... }: {

  options.myoption = lib.mkOption {
      type = lib.types.attrsOf (lib.types.submodule (
        import ./mysubmodule.nix
      ));
  };

}

and mysubmodule.nix is:

{ name, lib, config, ... }: {

options.mysubmoduleoption = {
  type = lib.types.str;
};

config = {
  # here I want to set a "global" option, say "systemd.mounts"
  # based on the value of "mymodule.name.mysubmoduleoption"
  # but it seems I can only set values under "mymodule.name" 
};

}
9
submitted 1 year ago* (last edited 1 year ago) by gomp@lemmy.ml to c/nixos@lemmy.ml
 

I'm trying to debug a module I'm writing with builtins.trace, but it's being more complicated than I anticipated.

Let's say I have a module:

{ config, lib, pkgs, modulesPath, ... }:

{

  config =
  let
    some-list = lib.attrsets.mapAttrsToList (n: v: {
        some-attr = "${n} ${v}";
    }) { n1 = "v1"; n2 = "v2"; };
  in {
    users.mutableUsers = builtins.trace (some-list) false;
  };

}

This will print

trace: [ <code> <code> ]

because builtins.trace (for whatever reason?) evaluates its first argument only shallowly.

Changing the trace expression to:

builtins.trace (builtins.toJSON some-list) false;

helps a lot, but as soon as one tries to print a long list or a structure with some complexity the output is completely unreadable, and it's not like it can easily be piped into jq (I mean... &amp;| grep ^trace: | sed 's/trace: //' | jq works*, but there must be a "better" way?)

(*) in fish shell, IDK about bash

edit: It's not like I specifically want JSON output: any format will do (ideally, nix would be nice)

 

I need to generate a number of scripts in my configuration and make them into a single package (for ease of reference, because there are a lot of them).

So far, I'm creating the scripts via writeShellApplication, making them into packages via an overlay, merging them with buildEnv and then adding the resulting package to `systemPackages.

Something like:

nixpkgs.overlays = [ (final: prev: {
  my-hello-1 = final.writeShellApplication {
    name = "my-hello-1-script";
    text = "echo my hello wolrd 1";
  };
  my-hello-2 = final.writeShellApplication {
    name = "my-hello-2-script";
    text = "echo my hello wolrd 1";
  };
  my-hello-scripts = final.buildEnv {
    name = "my-hello-scripts";
    paths = [ final.my-hello-1 final.my-hello-2 ];
  };
}) ];

environment.systemPackages = [ pkgs.my-hello-scripts ];

This works, but I don't really need the my-hello-1 and my-hello-2 packages... can you think of a way to make do without needing them?

 

I'm migrating my NAS to nixos, and I got to the point of setting up my restic backups.

services.restic.backups is great, but -- on top of the systemd timers/services -- I also want some helper scripts (eg. one to easily mount the backups, stuff that with ansible I currently generate into /usr/local/sbin).

These scripts would be entirely generated from the services.restic.backups config and would reference sops secrets also from configuration.nix, so... I don't think it would make sense to make a package out of them?

What should I use to make these scripts? Should I use nixpkgs.writeShellApplication and then alter the PATH?

 

Since I need to run a few apps that won't work on LineageOS (because dumb developer security stance), I need to buy a "regular" android device that includes all the google "services".

Ideally, it should be a cheap second-hand phone that will still receive security updates for a long time.

Are there bands that are better (well, "less worse") than others from a privacy perspective?

view more: ‹ prev next ›